Thursday, July 19, 2012

Add Thumbnails to “Popular Posts”, “Similar Posts”, “Recent Comments”,


Add Thumbnails to “Popular Posts”, “Similar Posts”, “Recent Comments”, etc.

Note: You will need to use any plugin from Rob Marsh to be able to do this.
poposts-thumbnailsI used Custom Fields for this. if you don’t know how to use custom fields, read this article at the WordPress Codex.
If you use the teasers Thesis has on your blog and have 66×66 images then most of the work will already be done for you. If not, create a custom field and paste your image URL’s into it.
So if you use Rob Marsh’s “Popular Posts” plugin for example, go to Settings → Popular Posts → Output and paste this code into the very first input box “Output Template”:
<p>
<img src="{custom:thesis_thumb}" width="50" height="50" alt="" />{link}
<div class="clear"></div>
</p>
You may also need to add this to your CSS, unless you already have it. You need a clear in the code, or the output won’t look right.
.clear { clear: both }
And to add that to the sidebar, you could either copy and paste it into your Widgets panel, or if you chose not to use Widgets you can use this code to do it:
function PopPosts() { ?>
 <?php popular_posts(); ?>
<?php }
 add_action('SEE BELOW OPTIONS', 'PopPosts');
Since Thesis has a variety of sidebar hooks, you can choose one of the below to replace with “SEE BELOW OPTIONS” above:
  • thesis_hook_before_sidebar_1
  • thesis_hook_after_sidebar_1
  • thesis_hook_before_sidebar_2
  • thesis_hook_after_sidebar_2

No comments:

Post a Comment