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.
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
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
Requires: 3.0 or higher
Compatible up to: 4.3.5
Last Updated: 8 months ago
Active Installs: 10,000+
0 of 1 support threads in the last two months have been marked resolved.
Got something to say? Need help?