The GD Star Rating Plugin is a famous plugin that allows readers (without login or registration) to give scores to articles, posts, pages and even comments.
Therefore, it might be useful to rank the ratings and see which posts are popular. For example, the second table in this page shows the ratings by rank.
In order to create such page, you would need a WordPress Plugin to include PHP code in the pages/posts. You can search ‘Include HTML and PHP’ and add the plugin.
Once you have done this, create a new Page (Post is OK), and put the following:
Then, go to the folder of your wordpress theme and create the top.php as specified above.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | <?php global $wpdb; $query = " SELECT `p`.`ID`, `p`.`post_name` as `name`, `p`.`post_title` as `title`, `visitor_votes` + `user_votes` as `total_votes`, `visitor_votes`, `user_votes` FROM `".$wpdb->prefix."gdsr_data_article` as `da` INNER JOIN $wpdb->posts as `p` ON `da`.`post_id` = `p`.`ID` having `total_votes` > 0 order by `total_votes` desc limit 20 "; $results = $wpdb->get_results($query); if ($results) { $position = 0; foreach ($results as $toppost) { $position++; echo "#".$position."<a title='".htmlentities($toppost->title, ENT_QUOTES). "' href='/archives/".($toppost->ID)."/'>".$toppost->title."</a> - ". ($toppost->total_votes)." <BR>"; } } ?> |
<?php global $wpdb; $query = " SELECT `p`.`ID`, `p`.`post_name` as `name`, `p`.`post_title` as `title`, `visitor_votes` + `user_votes` as `total_votes`, `visitor_votes`, `user_votes` FROM `".$wpdb->prefix."gdsr_data_article` as `da` INNER JOIN $wpdb->posts as `p` ON `da`.`post_id` = `p`.`ID` having `total_votes` > 0 order by `total_votes` desc limit 20 "; $results = $wpdb->get_results($query); if ($results) { $position = 0; foreach ($results as $toppost) { $position++; echo "#".$position."<a title='".htmlentities($toppost->title, ENT_QUOTES). "' href='/archives/".($toppost->ID)."/'>".$toppost->title."</a> - ". ($toppost->total_votes)." <BR>"; } } ?>
You might need to adjust the URL forms for wordpress posts if they are different, other than the one shown here.
–EOF (The Ultimate Computing & Technology Blog) —
Last Post: The bitand in Matlab
Next Post: Javascript Function To Jump Out Of The Frame