WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need a widget that does displays the following for related posts

  • Post Title
  • Thumbnail

Preferably it displays related posts by category.

So far I tried these widgets, which are partly working or don't working (with WP v3.3):

Partly working:

  • "Related Links by category": works, but no thumbnails
  • "Posts by same category widget": works, but no thumbnails
  • "Widgets of Posts by Same Categories": works, but no thumbnails

Not working:

  • "YARPP - Yet another related posts plugin": shows up, but nothing related.
  • "ELI's Related Posts Links and Widget": doesn't even show up in the widget list
  • "Related Posts widget": doesn't show up in the sidebar
share|improve this question

closed as off-topic by Pieter Goosen, Mark Kaplun, gmazzap, ialocin, cybmeta Dec 9 '14 at 11:29

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.

So what's your question? Couldn't one of the working plugins be modified into displaying a thumbnail to? – t31os Dec 16 '11 at 12:47
I could write my own also. But I ain't currently got time for that. I was searching for a take and go solution. After looking through about 20 widgets/plugins, I couldn't find a single one, so I asked here. Sadly the "youngest" plugin had it's last update 93 days ago... – kaiser Dec 16 '11 at 13:52
here is a widget wordpress.stackexchange.com/a/36448/2048v You have to edit the query to fit your needs! – Philip Dec 16 '11 at 17:02
up vote 1 down vote accepted

Assuming your happy to accept a solution involving one of the plugins you listed under the "Partly woking:" heading.

Widgets of Posts by Same Categories

Only need literally 1 or 2 lines of code, depending on how you want to handle the "post does not have a thumbnail" scenario.

Around this area of the plugin file..

$postslist = get_posts("category=$cat_ID&numberposts=$numberposts&orderby=$orderby&order=$order&exclude=$exclude_posts");
foreach ( $postslist as $post ) :
    <li><a href="<?php print get_permalink($post->ID); ?>" title="<?php  print get_the_title($post->ID); ?>"><?php  print get_the_title($post->ID); ?></a></li>
<?php endforeach; ?>

All you need to add there is something along the lines of the example on the has_post_thumbnail codex page.

if( has_post_thumbnail() )

For example..

$postslist = get_posts("category=$cat_ID&numberposts=$numberposts&orderby=$orderby&order=$order&exclude=$exclude_posts");
foreach ( $postslist as $post ) :
if( has_post_thumbnail() )
    <a href="<?php print get_permalink($post->ID); ?>" title="<?php  print get_the_title($post->ID); ?>"><?php  print get_the_title($post->ID); ?></a></li>
<?php endforeach; ?>

Though i guess it depends how exactly you want the implementation to work..

Does that help? :)

share|improve this answer
Worth an upvote. Give me your mail addy, and I send you my login data ;). Thanks mate. As I guess this could interest other people too, I'll leave it as open before marking it as solution, so I can upvote other possible answers as well. k? – kaiser Dec 16 '11 at 18:14
What would i want your login data for? You're welcome to wait to accept an answer though, i'm in no hurry to score votes, was only trying to help ya out.. ;) – t31os Dec 16 '11 at 21:47
To finish your job! :D – kaiser Dec 17 '11 at 0:23
lol, no chance, i know you're more than capable.. :p – t31os Dec 17 '11 at 10:02

Not the answer you're looking for? Browse other questions tagged or ask your own question.