A Better Way to Sort
-
Thanks to this article, we were able to implement the ability to sort by number of views.
However, this method is not in the order of the Most viewed tab on the stats page.
This is because the meta field values are only updated when the page is viewed, and the meta field values for pages that have not been viewed for a long time will remain the same.Example:
If a page with a ‘views_daily’ value of 5 is not viewed by anyone for 24 hours, the value will remain 5 after 24 hours.The solution is to periodically update the meta field for all articles. However, this is not practical if there are many pages.
It is not a bad idea to specify a time period in the query. It won’t be the same as the stats page, but it is easier.
- The topic ‘A Better Way to Sort’ is closed to new replies.