This tutorial provides the solution you need to display the most popular posts by number of visits ( views ) using the Genesis featured posts widget, By default, the featured posts widget doesn’t include a setting to show popular posts.
In this tutorial i’ll show you how to add a setting to the Genesis featured posts widget so you can choose to show posts by number of views.
Firstly, here’s the “Views Count” option added to the featured posts widget:
The code adds an extra setting to the options in the orderby drop down menu.
Demo Video #
Shows featured posts displaying in the primary sidebar by order of most views based on how many times the single post loads.
Tested using the Genesis Sample child theme by StudioPress however will work in any Genesis child theme without modification.
Installation Steps
There’s 2 simple steps:
# Step 1 : Upload the file named popular-featured-posts-widget.php to your child themes root directory.
# Step 2 : Copy & paste the PHP code from the functions.php file to the end of your child themes functions.php file.
You can then drag the widget named Popular Featured Posts into any widget area and select the orderby setting to Views Count as seen in the above screen shot.
Here’s the code for logged in members:
Was This Tutorial Helpful?