How to Display Popular Posts with Thumbnails in Thesis Theme

This tutorial is exclusively for Thesis Framework, a new templating system for WordPress. Create any sort of layout for your website using Drag & Drop Builder.

Share This Article:

Tutorial on How to Display Popular Posts with Thumbnails in Thesis Theme sidebar without using a plugin. It is good to list popular posts in the sidebar, which helps to get more attention from the blog readers. In General, popular posts are the ones with more user activity in the form of discussion through comments.

Display popular posts with thumbnails thesis theme

So articles with more comments can be considered as the popular posts and this tutorial will help you to list popular posts with thumbnails in Thesis Theme Sidebar.

Tutorial on How to Install Thesis Theme on WordPress

Tip: Backup your WordPress theme before editing theme files.

Display Popular Posts with Thumbnails in Thesis Theme

This code helps to display popular posts with thumbnails based on the number of comments. Simply add this to custom_functions.php file and update it We have already tested this code and it works fine with latest version of Thesis also. See How to Customize Thesis Theme directly from WordPress Dashboard.

/** Start of Popular Posts with Thumbnails in Thesis Theme */
function popular_posts() {
if (is_home()) { ?>
<div id="popular-posts">
<h3>Popular Posts</h3>
<ul>
<?php $popular = new WP_Query('orderby=comment_count&posts_per_page=5'); ?><?php while ($popular->have_posts()) : $popular->the_post(); ?>
<li><a href="<?php the_permalink(); ?>"><img src="<?php echo bloginfo('template_url'); ?>/lib/scripts/thumb.php?src=/<?php
$values = get_post_custom_values("thesis_post_image"); echo $values[0]; ?>&w=65&h=45&zc=1&q=100" alt="<?php the_title(); ?>" class="img" width="65" height="45" /></a><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a>
</li>
<?php endwhile; ?>
</ul>
</div>
<?php }
}
add_action('thesis_hook_after_sidebar_1', 'popular_posts');
/** End of Popular Posts with Thumbnails in Thesis Theme */

Just check the highlighted part of the code and you can change things like number of posts to be displayed, thumbnails width and height etc things easily.

You can use any other thesis hook to display popular posts at that particular place.

Other Thesis Theme Customization Tutorials:

Add CSS to Popular Posts with Thumbnails in Thesis Theme

Final step is to add some CSS to the popular posts in thesis theme. Here is the CSS code that helps to align and style elements in the popular posts. Add this code to custom.css file and update it.

/** Start of Popular Posts with Thumbnails CSS */
.custom #popular-posts {
margin: 0 0 15px;
float: left;
}
.custom #popular-posts ul {
float: left;
list-style: none outside none;
}
.custom #popular-posts ul li {
border-bottom: 1px solid #EEEEEE;
display: block;
float: left;
padding: 8px 0;
width: 100%;
}
.custom #popular-posts ul li a {
font-size: 13px;
line-height: 20px;
}
.custom #popular-posts ul .img {
float: left;
margin-right: 10px;
}
/** End of Popular Posts with Thumbnails CSS */

You can add your own CSS to these popular posts and can change any part of it, to make popular posts fit with your theme.

Hope you like this simple tutorial on How to Display Popular Posts with Thumbnails in Thesis Theme without using a plugin and if you need help in adding the same to your blog, then drop a comment here and we are glad to help you.

This tutorial is exclusively for Thesis Framework, a new templating system for WordPress. Create any sort of layout for your website using Drag & Drop Builder.

Genesis is the most flexible WordPress theme framework that comes with tons of options. We have been using Genesis on all of our blogs and recommending the same to you. Every bit of it is coded according to the standards. Give it a try!

Comments

  1. Kulwant Nagi says:

    I am searching to display same in Genesis !! Please write tutorial on that also.

    • WPSquare says:

      Most part of the code is same and we will write a detailed tutorial for Genesis also.

  2. Naveen says:

    Good tutorial, I can implement it on one of my client’s site.

  3. Saad says:

    Great Tutorial Working Great :)

  4. PrIyAnGsHu says:

    Great tutorial Bharat. I was using a normal Popular Posts widget on my site running on Thesis, but will try this one. This looks to be quite attractive.

    • WPSquare says:

      Using thumbnails, will surely grab the user attention and thanks for dropping by.

  5. Mukesh Kumar says:

    in my Thesis Theme image & Tittle not show in same row……. plz help me here the Screenshot … https://picasaweb.google.com/lh/photo/4xnyfCKHrL6TQKtzYZcLGfHvaCnpn724LZft__V-CPg

    • WPSquare says:

      Hello Mukesh, code has been updated and you can try it now.

  6. prabhat says:

    nice article, tried the code but its not showing the images, it is showing a blank box. i am using ”thumbnail for excerpts” plugin to generate thumbnails, may be that is causing the problem. can you please tell me, which code are you using on this blog to generate thumbnails and how to resolve this problem….please i am dying for it..thanks

  7. shihab sumon says:

    hi, nice your code, it only for home page. but i want to display it every where mean every single post too. then what can i do?

Speak Your MindComments Policy →

*

Looking for More Awesomeness?

Read previous post:
disable-right-click-on-images-wordpress
How to Disable Right Click on Images in WordPress

Disable Right Click on Images in WordPress and protect your copyrighted images from internet surfers.Whenever copyrighted images are used in...

Close