Popular Post By Month in WordPress

I’ve tested your code on my installation and it is working just fine. So the code in not an issue. There are two possible reasons why this is not showing any posts. 1) You do not have any posts for that month 🙂 2) You haven’t any metadata ‘wpb_post_views_count‘ in database so it returns nothing. … Read more

popular post for week and month

Unless you’re storing that data, you can’t. It looks like posts_views_count is just a running total, so unless you’ve stored per month/week data, it simply does not exist. What’s more, you’re storing that data in a post meta value, which has a lot of performance and accuracy problems. It’s: incompatible with any form of page … Read more

How to display the top 5 popular links in the header?

Put this in your functions.php file function k99_post_hits( $id, $action ) { $dl_HitMetaField = ‘_dl_post_hits’; // hidden Custom field that stores the views $dl_PostHits = get_post_meta($id, $dl_HitMetaField, true); switch ($action) { case ‘count’ : if ( $dl_PostHits ==” ) { $dl_PostHits = mt_rand(10,20);//just for debug-test – remove for real count delete_post_meta( $id, $dl_HitMetaField); add_post_meta( $id, … Read more