How to display Popular Post in your wordpress sidebar
Two Days ago I wrote a post about How to display recent posts in your wordpress sidebar and gave reasons on why one should include that. A few of the users brought up the point that displaying Popular Post is equally if not more in the benefit of the user. It is very debatable because in some cases recent post works better whereas in some cases popular post would work better. Therefore, I have decided that I will show my users to install the popular post in their wordpress as well. (Also this was requested by Bruce of Authority Directory)
Popular Post Plugin
This plugin will display popular post in your sidebars, or anywhere where you want to put this plugin. The popular post will be determined by pageviews.
This plugin would work easier for those who will use it dynamically with the widget in the admin panel. If you want to include this somewhere else other than the sidebar of the template, you can still do it. I have added a very useful article to Balkhis which shows How to add Dynamic Sidebar in wordpress. Basically follow that tutorial, if you want to display it in some other place than your sidebar, but want to use the widget area in the admin panel. All what you would have to do is paste the last code discussed in that tutorial anywhere on the template for instance footer or whatnot.
Once you have done that,
Upload the plugin, Activate it.
Go to your Themes section and click on the sub menu that says Widgets.
Add this widget into your selected sidebar, and customize it. You are good to go.
Now If you don’t have any issues with codes and can edit those very well, than you can also take the approach of doing it simply the codes way rather than the widget way.
You can display this code anywhere in your template:
<?php if (function_exists(’WPPP_show_popular_posts’)) WPPP_show_popular_posts(); ?>
This is just a basic code that will show popular post. You would still have to download and activate the plugin.
You can also add multiple parameters to make your plugin customized.
title (title of the widget, you can add tags (e.g. <h3>Popular Posts</h3>) default: Popular Posts)
number (number of links shown, default: 5)
days (length of the time frame of the stats, default 0, i.e. infinite)
show (can be: both, posts, pages; default both)
format (the format of the links shown, default: <a href=’%post_permalink%’ title=’%post_title%’>%post_title%</a>)
For the format there are more variables also.
%post_permalink% the link to the post
%post_title% the title the post
%post_title_attribute% the title of the post; use this in attributes, e.g. <a title=’%post_title_attribute%’…
%post_views% number of views
For more information on this visit: FAQ Page
Hopefully this helps you guys.









May 15, 2008
















Very nice Syed - Now that I finally added entrecard my next task I have set is to upgrade to the new version of wordpress. I know it is supposed to be easy, but I always am concerned about messing something up that I can’t fix.
Then I can workout adding the most popular posts you convered here.
lol you know How to IM me if you screw up … just make sure you backup everything before you upgrade
Well the upgrade is done and I was chatting with you via im the whole time…. It was very smooth. Thanks for the help!
so you now think thats its more important than recent posts.
j/k
Thanks for the informative post.
Never said i think it is more important ….
I said some users think it is … I am one of those who think it might be equal
I said j/k..
Great, i’ll add this on my wordpress blog. Hopefully my traffic an income would somehow increase. Hahaha
You just gotta have the vision for success
Linking to other pages always gets traffic boost also Syed, excellent detail on these posts. Its obvious you spend a lot of time writing your posts.
Thanks for the post. I actually tried that but had some issues but maybe ill give it a shot again. I will be doing my popular posts in a top sidebar item with my next blog design for sure.