I am waiting for a reply from 48 hours, will I get my answer ???
Plugin Author
Ajay
(@ajay)
Hi Meet, I monitor the forums as regularly as feasible and it might be weekly at times.
I’m a bit confused by the question. The posts displayed by Top 10 should be in descending order by views by default.
Alternatively, you might want to see how the API works: https://gist.github.com/ajaydsouza/c8defd4b46e53240e376
Top 10 doesn’t save the counts in the meta, but in a separate table.
-
This reply was modified 9 years, 6 months ago by
Ajay.
Hey Ajay, thanks for the reply.
Let me make my requirement clear.
I do have 3500+ portfolio posts and I am using this plugin to record daily visits. I am showing posts according to categories in different page. Now my client wants me to show most popular posts in the top for a particular category. I am managing the page through WP_Query so I can manage them but I don’t know which key should I pass in query to sort it.
so,
$args = array(
‘post_type’ => ‘portfolio’,
‘post_status’ => ‘publish’,
‘order’=>’desc’,
‘orderby’=>”what should I write here”,
‘posts_per_page’ =>-1
);
$new_query = new WP_Query( $args );
I need to sort posts according to its visits, so the post with maximum post suppose to be in the top and the least one in the bottom.
I hope my requirement is clear to you now.
Have a good day 🙂
Plugin Author
Ajay
(@ajay)
Yes, you don’t have a meta key, you need to use the API as per my post above with the 'post__in' argument for WP_Query