A user in our facebook community asked if we could show how to make a page that display popular posts by day, week, month, and all time in WordPress. We have decided to take it a notch higher and decided to add the tabber aspect in it as well. So in this article, we will show you how to add a tabber with popular posts by day, week, month, and all time in your WordPress sidebar without editing a single line of code. We will also show you how to create a separate page that displays popular posts by day, week, month, and all time in your WordPress blog.
How to Add a Tabber with WordPress Popular Posts
Normally, you would have to add bunch of jQuery code, add your own CSS, get down and dirty with the codes in WordPress files only to waste time and build frustration. So in this technique, we will be adding a tabber in our WordPress sidebar that lets you display popular posts by day, week, month, and all-time. To accomplish this, we will be using the plugin called WordPress Popular Posts, and Tabber Tabs Widget.
Note: In order for this technique to work, your theme must be Widgets Ready.
Lets go ahead and install/activate these WordPress plugins.
Now head to your Widgets screen that can be found Appearance » Widgets. Here you will see two widgets added (one is called Tabber Tab Widgets and the other is called WordPress Popular Posts).
You will also see a new widget location added in the right called “Tabber Tabs Widget Area”. Drag the WordPress Popular Posts widget in this location. Set the title to Daily, time range to today, select your sorting options, how many posts you want to show, and save the widget. Repeat this process 3 more times, so you can have one tab for each time range (daily, weekly, monthly, all-time). The final view should look like the image below:
Now look in the widget locations, you should see another one called Primary Sidebar or something similar. Drag your Tabber Tabs Widget into this location. Select the style you want, and save this sidebar. If your theme does not have a widget ready sidebar, you should consider asking the theme developer to add it, or switch to a theme that follows WordPress standards like the Standard Theme.
Note: Do not drag Tabber Tabs Widget into Tabber Tabs Widget Area.
The final outcome of this would look like this:
That wasn’t so hard was it? Now you can attract attention to your most popular posts in the sidebar and make them even more popular.
How to Add a Separate Page with Popular Posts
This technique requires you to know the basics of HTML/CSS and a fair understanding of how WordPress themes work. We will use the plugin called WordPress Popular Posts, and the custom page templates technique to accomplish our goal.
Once you have installed the plugin, go to Settings » WordPress Popular Posts. There is a help section that you want to keep open as you do this because you will be referring to the tables in there.
Use our Custom WordPress Page Template technique, to create a new page template. Add the appropriate styles to match your main blog theme. Then paste the code:
<?php get_mostpopular("range=daily&limit=10"); ?>
This will display the 10 most popular posts of the day. If you just want to have one page with a list of popular posts, or want to add this popular posts section to your Archives page, then you probably want to add other attributes to it as well. You can find other attributes in the help section of this plugin that we mentioned above. There is a huge table that shows you each attribute.
You can change the range to weekly, monthly, alltime. You can also add excerpts to each post, display a thumbnail next to them, and you can even display post ratings (if you follow our tutorial on how to add post ratings in WordPress).
You can also take this technique to the next level by creating 4 different pages for each time range. You can also customize it and add it to your Facebook page by creating an app. The possibilities of using this to your advantage are endless.
We hope this tutorial helped you. If it did, then please help us and your friends by sharing it with them on Twitter and Facebook.