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 be there forever. New post will come there but the previous post will not be gone from there.

Normally Popular post are like most poplular in 24 hours or something like that. It is ok but once it is shown it should not be gone after another 24 hours. May be in 24 hours 10 post are shown as popular and in another 24 hours another 5 post, but on the popular page all the post should be shown not only 5 post from this 24 hours but from previous 24 hours.

Any suggestion how to write this code. or any plugins. I know the rules of this forum. I should not ask any plugin but any code is also recommended. But i can also go with plugins.

1 Answer
1

Firstly read up on, Page Templates to learn how to create the pages you want.

Secondly getting recent posts is no problem, you just have to do a query with WP_Query using the order and orderby parameters accordingly.

Thirdly wordpress doesn’t count page views, you have to implement this yourself. Same applies to social counts of course. The comment count is the easy part, you can do this by default with wordpress. If you have all this you can combine all the values you have for example into a custom field and do a query with meta_* sorting by this field.

But the above is really just to get you started. I suggest you take a look around, there are solutions for page views and social counts on WPSE and out in other places. If you have done your research, you come back with more specific questions and some code to get more help achieving your goal.

Leave a Comment