In this article we are going to build out a most popular post section for Oxygen Builder. The Oxygen Builder repeater element as well as the easy posts element both come with advanced query features, and with just a little bit of work, you can easily display the most popular posts by page views for a WordPress website.
To do this, we are going to need a third party plugin, but it's freely available from the WordPress repository, fairly lightweight, and a great addition for any content website using this CMS.
Grab WP-PostViews and install it on your Oxygen Builder website. This plugin tracks the number of views that each post gets and stores that information in your database, meaning that you can easily query posts by their popularity. Keep in mind, that there is a built in popularity query using the oxygen builder, but this uses the comment count, and not the post view count.
This plugin isn't meant to be an analytics solution, and is very simple. Essentially, you install it and it automatically begins tracking the number of page views per post.
Once you've installed the plugin, it's time to build out your query. This is a very simple and easy process, all you need to do is copy and paste this code into the manual section of the query tab under the easy posts or repeater element in Oxygen.
Build out your query by using any of the standard WordPress terms. to order by popularity, you simply need to add this line (with the post views plugin enabled)
Here's an example query that we use on our website:
What this does is order the posts by the number of views associated with it. if you're looking to build out a most popular posts feature in oxygen builder, this is by far the best way to do it. if you have any questions don't hesitate to reach out via our comments section, and we hope that this was a beneficial article!