WP Most Popular is a simple plugin which tracks your most popular blog posts based on views and lets you display them in your theme or blog sidebar.
WP Most Popular was born out of frustration in finding a decent plugin which performs one simple task and that is to rank your most popular blog posts.
The plugin keeps a log of your most popular posts based on views and lets you display them in your blog theme with custom styling. You can display popular posts from the last day, 7 days, 30 days or all time.
It also comes with a sidebar widget to let you display your popular posts on your blogs sidebar.
If you are a developer and integrate the plugin in to a theme, you will get a lot more flexibility out of the plugin including the ability to show the most popular custom post types etc.
This plugin was built and is maintained by WP Geeks. For extra documentation, videos, snippets and support, visit the WP Most Popular product page.
There are two ways in which you can use this plugin.
Using the widget is the easiest way and recommended for most users. If you are a developer and want to integrate the plugin in to your existing theme, then read the information below.
Firstly, the main function which you will need to include in your theme to fetch the popular posts is called wp_most_popular_get_popular()
.
You can pass that function the following parameters in array form:
Those are the current parameters that the plugin supports. Let’s look at an example of how to display the most recent popular posts in a unordered list.
<?php echo '<ul>'; $posts = wp_most_popular_get_popular( array( 'limit' => 10, 'post_type' => 'post', 'range' => 'all_time' ) ); global $post; if ( count( $posts ) > 0 ): foreach ( $posts as $post ): setup_postdata( $post ); ?> <li><a href="<?php the_permalink() ?>" title="<?php echo esc_attr(get_the_title() ? get_the_title() : get_the_ID()); ?>"><?php if ( get_the_title() ) the_title(); else the_ID(); ?></a></li> <?php endforeach; endif; echo '</ul>'; ?>
The following filters are available to you:
element of the outputted widget list
* wp_most_popular_list_item_single – filters for a the list item generated by the widget
Setting up WP Most Popular is very simple. Follow these easy steps
/wp-content/plugins/
directorySetting up WP Most Popular is very simple. Follow these easy steps
/wp-content/plugins/
directory99% of the time this is because no posts have been visited yet to receive a ranking. Simply click on a blog post to read it on your blog and it will receive a ranking and display in the list of most popular posts.
You will need a web server or shared host that supports PHP version 5 or newer. Javascript is also required to log post views.
The original version of the plugin that I wrote used PHP to track the post views and the reason why I switched to Javascript was because if a caching plugin is enabled on your blog, the page will be loaded statically to your visitor and the PHP code to log a view on a post will not be run.
Yes, please do so on the WordPress support forum for the plugin. I will consider it and if I feel it is worth adding, I will schedule it for a future release.
Yes! The plugin is open source and I host it on Github. Feel free to send me pull requests.
This plugin is managed by WP Geeks and you can contact our support team on our website.
wmp_get_popular
was no longer working as it should for backwards compatibilitywp_most_popular_get_popular
. Please note that the old function name is still supported wmp_get_popular