12% off of LTD using this coupon: TWELVEPERCENTOFF. Promo ends on 2 Dec midnight UTC.
Published on Jul 17, 2019

Custom Related Posts Query using Easy Posts Preset

Sridhar Katakam

This members-only tutorial provides the steps to add a section on single posts to display 4 random posts (excluding the current one) in the same category/categories as the current post for a custom "related posts" functionality in Oxygen.

We shall add the PHP code for this in a Code Block to

  1. retrieve the current post's categories
  2. store the array of category IDs in a variable
  3. get comma-separated category IDs in a variable
  4. write a WP_Query arguments array
  5. write a basic loop to show post titles

and finally replace the above loop with PHP and CSS from the default Easy Posts component's preset.

Step 1

Edit the Template that applies to single blog posts with Oxygen.

Add a Section.

Add a Code Block inside.


This is a premium members-only content.

To view the rest of the content, please sign up for membership ($47/month or $599 one-time).

Already a member? Log in below or here.