Accomodating WP-PostViews and WP-PostRatings plugins to Popular Post Plugin (Wordpress)
I want to use a Wordpress plugin named: Popular Posts plugin (by Rob Marsh, SJ) . This plugin using 'pvc_views' metadata as an order in SQL query. With this plugin, I want to accomodate 'views' metadata (from WP-PostViews plugin) and 'ratings_score' metadata (from WP-PostRatings plugin) plugins too, instead of 'pvc_views' metadata. So I changed the source code, here they are:
— FILE: popular-posts.php (Version: 2.6.2.0) —
Find this :
$where[] = "meta_key = 'pvc_views'";
and then I changed with this:
if ($options['popular_mode'] == 'ratings_score') {
$where[] = "meta_key = 'ratings_score'"; //from plugin WP-PostRatings
} elseif ($options['popular_mode'] == 'views') {
$where[] = "meta_key = 'views'"; //from plugin WP-PostViews
} else
{
$where[] = "meta_key = 'pvc_views'"; //default;
}
— END OF FILE: popular-posts.php —
# New parameter:
- popular_mode:
- views, if you want to use views metadata (from wp-postviews).
- ratings_score, if you want to use ratings_score metadata (from wp-postratings).
- if popular_mode not defined, the default is using pvc_views metadata.
How to use:
To use wp-postviews as an order criteria, use this:
popular_posts('[.....]&popular_mode=views');
To use wp-postratings as an order criteria, use this:
popular_posts('[.....]&popular_mode=ratings_score');
Thank you. :)
NB: sorry if my English grammar is bad.

1 comment
Comment from: Adam Capriola Visitor

This post has 5 feedbacks awaiting moderation...
Nice guide, but I am a little confused.
1. What does the […..] mean? Where do I put that code?
2. How can I change the {postviews} output tag to show the WP-PostViews count too?
Thanks so much!
-Adam