Query same category posts in Oxygen repeater and exclude current post

Farhan
2 min readAug 3, 2022

Here is a tutorial on how to create a “related posts” repeater where categories of the post you are currently viewing will be queried whilst excluding the current post itself for better user experience.

My past iterations of this website used to have a sidebar which would always show the most recent 6 posts of the same category as the current post but excluding the current post. This is a fantastic way to allow users to explore more posts without having to go to a post archive page or simply exit the website. In fact, after doing this, my GA bounce rate saw some serious improvements!

I’m sure there is an easy way to do this but here is how I achieved this (please note, I will skip the styling portion):

The steps

Query dynamic data

Drop in an Oxygen repeater element wherever you want to show the post list and then drop in elements to query the relevant dynamic data as you require.

For example, I will simply drop in a heading (h4) element > double click on the default text > select Dynamic Data > select Post Title > check the Link option.

Doing the above steps will allow us to quickly see if the repeater query is working correctly.

You can of course style all these elements at any time as per your design requirements.

Query repeater

--

--

Farhan

I am currently a financial analyst training to become a chartered accountant. In my spare time, I build and blog about WordPress and VBA solutions for people.