Hi,
I have custom fields with image from posts, and I want to display the top 5 posts sorting by views. I am using WordPress, can you help me please?
Sorry for my bad English.
Thanks.
Hi,
I have custom fields with image from posts, and I want to display the top 5 posts sorting by views. I am using WordPress, can you help me please?
Sorry for my bad English.
Thanks.
http://www.wpbeginner.com/wp-tutorials/how-to-track-popular-posts-by-views-in-wordpress-without-a-plugin/
Basically it's adding a meta field to each post - and deletes the old record when it's viewed, then replaces it with 'old record + 1'
There's one error with Xhynk's reference:
The query it runs returns posts in alphabetical order (1, 2, 20, 23, 3, 4, etc)
You just need to change
to
For the top 5, use:
It is very easy. Just use this code into your functions.php
put single.php
This is your popular post query:
For details go