| « Masalah Kompatibilitas Postnuke 0.764 dengan PHP 5.2.* | Urutan Traffic Rank 5 Situs Partai Menjelang Pemilu 2009 » |
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:
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.