isotropic-2022
Share
Blog
Search
Menu

Building A “Most Popular” Posts Section In Oxygen Builder

By James LePage
 on October 24, 2020
Last modified on January 6th, 2022

Building A “Most Popular” Posts Section In Oxygen Builder

By James LePage
 on October 24, 2020
Last modified on January 6th, 2022

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)

orderby=meta_value&meta_key=views

Here's an example query that we use on our website:

posts_per_page=5&post_type=post&no_found_rows=true&post_count=5&found_posts=5&order=DESC&orderby=meta_value&meta_key=viewsCode language: JavaScript (javascript)

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!

Subscribe & Share
If you liked this content, subscribe for our monthly roundup of WordPress news, website inspiration, exclusive deals and interesting articles.
Unsubscribe at any time. We do not spam and will never sell or share your email.
Subscribe
Notify of
guest
5 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Tamas
Tamas
3 years ago

Hi, the images is unavailable. Could you please update them?

Isaura
Isaura
3 years ago

Hi James!

Thanks for the tutorial.

Do you know how to make it work with a custom post type in a taxonomy archives page?

I've changed the "&post_type=post" for "&post_type=my_cpt_name" but it doesn't work.

posts_per_page=5&post_type=my_cpt_name&no_found_rows=true&post_count=5&found_posts=5&order=DESC&orderby=meta_value&meta_key=views

Is it possible that I need to specify the taxonomy, as well? I want it to set up as a template that works for every taxonomy term in my custom post type.

Do you have any idea how to achieve that?

Thanks!

Isaura
Isaura
3 years ago
Reply to  James LePage

Thank you very much, James!! 🙂 Yes, I replicate your "manual" code as an Advance Query of the Repeater, but I don't know WP_query or PHP, so I am not able to customize it to suit my needs!

Jonathan Starr
3 years ago

How would you do it via the Advanced Query Builder? We implemented it on the site but it is random in showing which one has the most views. Generally speaking, it is not accurate.

Article By
James LePage
Contributors/Editors
notloggedin
James LePage is the founder of Isotropic, a WordPress education company and digital agency. He is also the founder of CodeWP.ai, a venture backed startup bringing AI to WordPress creators.
We're looking for new authors. Explore Isotropic Jobs.
linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram