• Resolved jerickko

    (@jerickko)


    Instead of having just the image and title clickable, is it possible to turn the whole

    • into a link for the permalink?
Viewing 6 replies - 1 through 6 (of 6 total)
  • Unfortunately, that cannot be done at the moment without hacking my plugin’s source code. WPP does not offer that much flexibility yet so if you want to achieve that you’ll have to get your hands dirty with code.

    I can guide you with that, however chances are that you’ll have to apply this every time WordPress Popular Posts is updated to a newer version.

    Thread Starter jerickko

    (@jerickko)

    I don’t mind if that’s ok with you.

    I have to update the timthumb.php file at each update anyway

    Alright then, please follow these instructions:

    1. Open wordpress-popular-posts.php using your favorite editor such as Notepad or Adobe Dreamweaver.
    2. Around line 650, change

      $thumb = "<a href=\"".get_permalink($wppost->ID)."\" title=\"". htmlspecialchars($title_attr) ."\"><img src=\"". $this->pluginDir . "/scripts/timthumb.php?src=". $img[1] ."&h=".$instance['thumbnail']['height']."&w=".$instance['thumbnail']['width']."&zc=1\" alt=\"".$wppost->post_title."\" border=\"0\" class=\"wpp-thumbnail\" width=\"".$instance['thumbnail']['width']."\" height=\"".$instance['thumbnail']['height']."\" "."/></a>";

      into

      $thumb = "<img src=\"". $this->pluginDir . "/scripts/timthumb.php?src=". $img[1] ."&h=".$instance['thumbnail']['height']."&w=".$instance['thumbnail']['width']."&zc=1\" alt=\"".$wppost->post_title."\" border=\"0\" class=\"wpp-thumbnail\" width=\"".$instance['thumbnail']['width']."\" height=\"".$instance['thumbnail']['height']."\" "."/>";

    3. Around line 678, change

      $content .= '<li>'. $thumb .'<a href="'. get_permalink($wppost->ID) .'" title="'. htmlspecialchars($title_attr) .'">'. htmlspecialchars_decode($post_title) .'</a>'. $post_content .' '. $stats . $rating .'</li>' . "\n";

      into

      $content .= '<li><a href="'. get_permalink($wppost->ID) .'" title="'. htmlspecialchars($title_attr) .'">'. $thumb .' '. htmlspecialchars_decode($post_title) .' '. $post_content .' '. $stats . $rating .'</a></li>' . "\n";

    4. Save changes and close the file.
    5. You might also need to change your theme’s style to make the whole li clickable by setting the a tag’s display property style to block. Not too sure about this step, though.

    Please note that I haven’t tested this so if you encounter any errors please let me know.

    P.S.: why do you update the timthumb.php file each time? Got any problems with it?

    Thread Starter jerickko

    (@jerickko)

    Sorry Ikki24, I was away for a couple of days and couldn’t reply.

    I’ve tried the changes that you have suggested with display:block. The thumbnail link is removed, but it doesn’t make the whole li clickable.
    The 3. change for line 678 doesn’t affect how your plugin displays. I’ve tried to remove the line to see if it affects it in any way, but it doesn’t.
    Are there any changes that need to be done to line 675? I see an <a> and $thumb, but have no idea how that works.

    About timthumb.php, I need to make the changes because of my previous problem

    Are you using the custom HTML feature?

    Thread Starter jerickko

    (@jerickko)

    Yes, I’ve removed the unnecessary bits. It works now. Thank you so much for the help

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘[Plugin: WordPress Popular Posts] Make whole <li> clickable’ is closed to new replies.