How to Display a Popular Posts List in WordPress

Nowadays every business is focusing on web promotion in the form ads, content display ads on the website.. A lot of people surely have google analytics reports in their hands but they may not know what to do next and how to best utilize the google analytics data and reports to boost their sales. There needs to be someone to guide and suggest you things that will make you the best performer.

In this article, we will show you how to track and display popular posts by views in WordPress without using any plugins and also an alternative with a plugin.

How to install popular posts lists without a plugin

First thing we need to do is create a function that will detect post views count and store it as a custom field for each post. Paste the following codes in your theme’s functions.php file 

function wpb_set_post_views($postID) {
    $count_key = 'wpb_post_views_count';
    $count = get_post_meta($postID, $count_key, true);
    if($count==''){
        $count = 0;
        delete_post_meta($postID, $count_key);
        add_post_meta($postID, $count_key, '0');
    }else{
        $count++;
        update_post_meta($postID, $count_key, $count);
    }
}
//To keep the count accurate, lets get rid of prefetching
remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0);

Now we need to call this function on the single post pages. This way the function knows exactly which post gets the credit for the views. To do this, paste the following code inside your single post loop:

	
wpb_set_post_views(get_the_ID());

If you are using a child theme then you should simply add the tracker in your header by using wp_head hook. Paste the following code in your theme’s functions.php file or the site-specific plugin:

function wpb_track_post_views ($post_id) {
    if ( !is_single() ) return;
    if ( empty ( $post_id) ) {
        global $post;
        $post_id = $post->ID;    
    }
    wpb_set_post_views($post_id);
}
add_action( 'wp_head', 'wpb_track_post_views');

If you are using a caching plugin, this technique will NOT work by default. Here is what needs to be changed:

<!-- mfunc wpb_set_post_views($post_id); --><!-- /mfunc -->

Finally you are able to do all sort of cool stuff such as display post view count, or sort posts by view count. If you want to display the post view count on your single post pages the first thing you need to do is add the following in your theme’s functions.php file or the site-specific plugin.

wpb_get_post_views(get_the_ID());

If you want to sort the posts by view count, then you can do so easily by using the the wp_query post_meta parameter. The most basic example loop query would look like this:

<?php 
$popularpost = new WP_Query( array( 'posts_per_page' => 4, 'meta_key' => 'wpb_post_views_count', 'orderby' => 'meta_value_num', 'order' => 'DESC'  ) );
while ( $popularpost->have_posts() ) : $popularpost->the_post();
 
the_title();
 
endwhile;
?>

Looking for a more convenient way? Then you are covered with this plugin solution.

How to Boost Sales with Popular Posts Lists with MonsterInsights

MonsterInsights helps to show your readers the great and popular blog posts on your website and gain easy page views, user engagement and keep logging visitors on your website. If more people are reading your content, then you can get more clicks and conversion ultimately. Monsterinsights comes with 3 popular features to display the most popular posts on your website and to gain outstanding performance and increased revenue share.

  1. Inline Popular Posts : It helps to display posts within the text of your content.
  2. Popular Posts Widget: It can show up to 10 articles anywhere on your site, such as your sidebar or at the end of the post.
  3. Popular Products: If you have an eCommerce store, then make your popular products visible and boost your revenue with these attractive features.

Popular Products in WordPress E-Commerce Sites

If you have an eCommerce website then you can show the related and popular products so that the chances for increasing the sales are more. You can easily show popular products using MonsterInsights popular products.

You can show the popular products from the selected category. Suppose, the reader is searching for clothes then you can show the popular clothes from the websites.

Popular Posts are Customizable in terms of looks and feel

Popular Posts is designed to suite and work with all WordPress themes. This feature has a wide range of customization with which you can change the color schemes,  styles and layouts as per your needs. You can also add your own custom labels. The image below is a representation of the customizer.

The good thing about this feature is that you can change all settings from within the WordPress dashboard. Also you can change the settings while working inside your posts for an inline popular post.

Choose The Popular Posts To Display

Monsterinsights offers 3 ways to display which posts to show the popular posts. You can start your popular posts based on the comments, number of shares and manually select the top posts. There is even a possibility of combining automated and curated popular posts. If you have custom dimensions set up on MonsterInsights, the top 10 posts from the last 30 days will be automatically added.

Automated + Curated option allows you to combine posts using custom dimensions based on last 30 days. This feature also lets you randomly display your top 5 posts according to your google analytics in widgetized areas or in-line in your posts.

Contextual Insights

Contextual Insights is a feature of MonsterInsights that sends notifications to you regarding your website’s performance and insights which is viewable from within your WordPress dashboard. These timely notifications get you accurate statistics of demographics, region, age, gender etc which helps you to learn and devise strategies to grow your business.

If you want to use this feature then you will have to purchase the MonsterInsights premium plugin, then why you are waiting, get the premium version.

In order to boost your website sales, or page views or getting more user engagement, MonsterInsights is the top rated solution for your business success. You can rely on it for your business exposure at agreta extent.

Conlusion

MonsterInsights Popular Posts and Contextual Insights features will help you to increase the page views and also decrease the bounce rate. You can also increase the sales of eCommerce websites by showing the related products.

This way you have a better chance to best utilize your google analytics data to boost and take your business to the next level. So in short you can understand that this feature of MonsterInsights is just like your personal assistant who helps you with your appointments.

Leave a Reply

Your email address will not be published.

Share This

Copy Link to Clipboard

Copy