Breaking News
Home / HOW TO / How to display popular posts in a blog sidebar

How to display popular posts in a blog sidebar

The wordpress sidebar can be use to display popular post  that catches the eyes of a blog visitor.

it can be use to display a blog popular blog posts, a blog facebook fan page, recent blog posts and  host of many others cool stuff,

Many users normally ask how can they display a popular posts in their  blog sidebar with a plugin.

There are many plugins that can be use to display a blogs popular post but we at Goldenspeak.com prefer wp tabbed widget by themeshop because the plugin uses the power of ajax, that is to tell you that the speed of  your blog was put into consideration when the developers developed the plugin .

To display popular posts in your blog sidebar, download and install wp tabbed widget by themeshop  in the worpress directory .

If you do not know how to install a plugin click here.

After a successful activation of the plugin, visit Appearance » Widgets page at the left corner of  worpress admin area.

Just look for  wp tabbed widget by themeshop.

wp tabbed widget

click on it ,hold down with your mouse and drag to the position you want your popular post to be displayed in the sidebar.

wordpress sidebar

 

Here you can configure the plugin according to what you want it to do for you, after which click on the  save button.

P.S  The wp tabbed widget by themeshop apart from displaying popular posts, it  can also be use to display recent posts, recent comment and a tag tab. what it displays depend  on how you configured it.

For those that have little knowledge of php, you can display a popular post without plugin in your blog sidebar. All you have to do is add a little php function to your sidebar. just drag the html widget to your blog sidebar and add the below php code.

<o/>

<div class=”box”>

<div class=”box_title”>Most popular Posts</div>

<div class=”box_content”>

<ul>

<?php

query_posts(‘orderby=comment_count&posts_per_page=5’);

//If there are posts. checks to see if the current query has any results to loop over.

if (have_posts()) :

//loop through the posts and list each until done.

while (have_posts()) :

//Iterate the post index in The Loop.

the_post();

?>

<li><a href=”<?php the_permalink() ?>” title=”Permanent Link to: <?php the_title_attribute(); ?>”><?php the_title(); ?></a> <?php echo ‘(‘ . get_comments_number() . ‘)’; ?></li>

<?php

endwhile;

endif;

//Destroy the previous query. This is a MUST.

wp_reset_query();

?>

</ul>

</div>

</div><!– end of most popular posts

</o>

this function shows popular posts base on comment count.The default function shows 5 popular post per page </o>    query_posts(‘orderby=comment_count&posts_per_page=5’)</o>

you can alter the number to suit what you want.

i hope with this you can display a popular post in your sidebar with and without a plugin. show some love by liking our page on facebook and also follow us on twitter for more update.

find us on facebook find us on twitter

Check Also

Federal University of Technology Akure (FUTA)

FUTA POST UTME RESULT CHECKER

Following the conclusion of the Post utme exercise by the management of  Federal University of …

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.