1

I need to add featured image somewhere near title so I can easier sort them, currently the plugin use this code to show the title only, tried with the_post_thumbnail and nothing is showing up. Thank you.

            echo '<li id="'.$post->ID.'">';
            echo '<span class="title">'.$post->post_title.'</span>';
            echo '</li>';

1 Answer 1

3

Since this is a plugin, it's probably going to get axed, but generally speaking in WordPress if you want to get a posts featured image and you have access to the post ID (which I'm assuming you do), you can always do this:

$thumb_url = wp_get_attachment_url( get_post_thumbnail_id( $post->ID ) );

So without looking at the plugin, it looks like you might be able to do something like this:

$thumb_url = wp_get_attachment_url( get_post_thumbnail_id( $post->ID ) );
echo '<li id="' . $post->ID . '">';
echo '<img src="' . $thumb_url . '" alt="" />';
echo '<span class="title">' . $post->post_title . '</span>';
echo '</li>';

Set your styles on the image accordingly (height/width/float/margins/etc.)

2
  • GENIUS!!! Is working! How can I send you a beer at least? Nov 18, 2014 at 0:22
  • An accept/upvote will suffice. Glad it worked. Also, if you're not already aware... if you're modifying the plugin source, updating the plugin will wipe this out.
    – BODA82
    Nov 18, 2014 at 0:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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