Popular Posts: Featured Image & All In One SEO Description

the Popular Posts Plugin allows you to use a number of ‘tags‘ (similar to shortcodes) to alter the output of the Popular Posts Widget.  Here’s what my client wanted to display with the Popular Posts Plugin: Featured Image (Thumbnail Size) , followed by the Description filled out in the All In One SEO settings for the post.

I freakin googled like mad to figure this out.  The main trouble I was having is that I was getting the same thumbnail for every ‘popular post’ …The reason is that you need to use

$result->ID

instead of

$post->ID

here’s what you do (note, my example is for if your thumbnails are set to be 100px by 100px in Settings>>Media)

{php: echo get_the_post_thumbnail($result->ID, array(100,100) ); }
{php:echo get_post_meta($result->ID, '_aioseop_description', true);}

Now, that was just the raw tags.

Here’s an example with some actual HTML in the mix (note I’m using nofollow for seo purposes and alignleft for layout purposes):

<li><a class="alignleft" rel="nofollow" href="{url}">{php: echo get_the_post_thumbnail($result->ID, array(100,100) ); }</a><a rel="nofollow" href="{php:echo get_post_meta($result->ID, '_aioseop_description', true);}"</a></li>

The End.

Now this (humans ignore){php} echo get_the_post_thumbnail($result->ID, array(100,100) ); echo get_post_meta($result->ID, ‘_aioseop_description’, true); echo get_post_meta($post->ID, ‘_aioseop_description’, true); echo get_the_post_thumbnail($Post->ID, array(100,100) );
 

If you found this information helpful, please consider making a donation. No amount is too small.
paypal.me/andrewapeterson





Bitcoin Donation Address:
1KAAN2ULpdZ2cjegDHYTXP1qXGLUybs5H6

2 Replies to “Popular Posts: Featured Image & All In One SEO Description”

Leave a Reply

Your email address will not be published. Required fields are marked *