WordPress.org

Ready to get started?Download WordPress

Plugin Directory

WP Most Popular

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.

Usage

There are two ways in which you can use this plugin.

  1. As a sidebar widget
  2. Custom function in your theme files

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 wmp_get_popular().

You can pass that function the following parameters in array form:

  • limit (integer)
    • The number of posts you would like to display i.e. 5
    • Default: 5
  • post_type (string) / (array)
    • The post type you would like to display
    • Example: post
    • Default: All post types
  • range (string)
    • In what date range would you like to display popular posts in
    • Accepted: all_time, monthly, weekly, daily
    • Default: all_time

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 = wmp_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>';
?>

Requires: 3.0 or higher
Compatible up to: 3.4.2
Last Updated: 2013-5-18
Downloads: 27,597

Ratings

4 stars
4.5 out of 5 stars

Support

0 of 1 support threads in the last two months have been resolved.

Got something to say? Need help?

Compatibility

+
=
Not enough data

0 people say it works.
0 people say it's broken.

0,1,0
100,1,1
89,9,8
100,2,2 100,1,1
100,1,1
100,1,1 100,2,2
100,3,3
67,3,2
100,1,1
100,1,1