Articles of popular posts

Sort Popular Posts by Views for the Last Week

I’m trying to sort the popular posts so it shows the most visited in the last week, but it hasn’t worked. Anyone have an idea of why it isn’t working? <?php $popularpost = new WP_Query( array ( ‘posts_per_page’ => 5, ‘ignore_sticky_posts’ => 1, ‘meta_key’ => ‘sw_post_views_count’, ‘orderby’ => ‘meta_value_num’, ‘order’ => ‘DESC’, ‘date_query’ => array […]

How to make two pages in wordpress to display recent pages and popular pages

I am creating a new wordpress blog. I want to make two pages on the blog. One page to display the popular post and another page to display the recent post. Popular post should be affected according to the page view, social share, comments. Once the post is shown on the popular page it should […]

Most commented / popular posts and offset

I am using this code to show 3 most popular posts based on number of comments : <?php $pop_posts = 3; $popularposts = “SELECT $wpdb->posts.ID, $wpdb->posts.post_title, COUNT($wpdb->comments.comment_post_ID) AS ‘stammy’ FROM $wpdb->posts, $wpdb->comments WHERE comment_approved = ‘1’ AND $wpdb->posts.ID=$wpdb->comments.comment_post_ID AND post_status = ‘publish’ AND comment_status = ‘open’ GROUP BY $wpdb->comments.comment_post_ID ORDER BY stammy DESC LIMIT “.$pop_posts; […]

How to install WordPress Popular Posts plugin twice?

I’ve installed WordPress Popular Posts plugin but found that it displays popular posts only from category. I want to display popular post for custom taxonomy. I found some hack in that plugin. Plugin might be work with custom taxonomy replacing category to custom taxonomy name. So I’m thinking to install same plugin twice with minor […]

How do I get a list of popular posts by views?

I am using the Jetpack plugin to get ‘site stats’ which shows the number of views for blog posts/pages. So I’m no expert or anything but I’m guessing there is a table that stores these views. Is there a way to manipulate this data to create a simple list of the most popular posts by […]

How to get popular post from across a network?

I have a multisite network on WP 3.3.1. I now need to get all popular posts from across this network (preferably based on the amount of views). Is this possible, and how do I do that?

Best approach to create Hot and Trending sections

I am going to implement a Hot and Trending section on a website. I have seen such sections on many popular websites but can’t really figure out how exactly this works. Although I assumed Hot section is most popular posts (based on post views) which I developed by a custom WP_Query. And it works. $args […]

Show the most popular post per week

The plugin Most Popular Posts doesn’t support WPML and therefore I have tried creating my own. I have found this tutorial in creating your own code for showing the most popular posts on my site: How to Display Popular Posts by Views in WordPress without a Plugin However this doesn’t take in the factor of […]

Show popular post in another php website via WP REST JSON API

I need to show popular & recent posts in another PHP web site under the same domain. Example: -> main website (php, mysql) -> WordPress blog Need to show popular, recent posts of blog in the main website. Please note that blog and main website use two separate database. I decided to use […]