When building a website blog using the Oxygen Page Builder, you may want to add a related posts section. This is particularly useful if you want to increase page views and keep people engaged on the related content on your site. There are a few different ways to create a related posts section in Oxygen Builder. In this post, we'll show you how to use the custom query and easyposts widgets. This method also doesn't require any additional plugins.
Set up a Custom EasyPosts Query
To set up a custom query, you'll need to add an easyposts widget. Then, click on query -> advanced. When you edit your query you'll be adding 5 parameters:
|Post & Page -> post type||data -> advanced -> post type|
|Post & Page -> post__not_in||data -> advanced -> post id|
|Pagination -> posts_per_page||3|
|Caching -> no_found_rows||true|
|Taxonomy -> tax_query||An array with 3 values:|
taxonomy -> category
field -> slug
terms -> add value -> data -> 'post_terms' taxonomy='category'
Once you set this, feel free to adjust the number of posts to display and other styling options.
Create a Randomized Posts Widget in Oxygen
If you don't want related posts, but want to show a selection of random posts, you can do that too. This is great for keeping people engaged on your site and looking at other content they may not know they'd be interested in.
To do this, delete the taxonomy parameter (with the 3 array values) and add another parameter. Now, every time you refresh the query (page) it will show a different set of posts.
|Order -> orderby||rand|
And that's it! You now know how to create a related posts or random posts widget in Oxygen Builder using the custom query and easyposts widgets. If you have any questions, feel free to leave a comment below.