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
- retrieve the current post's categories
- store the array of category IDs in a variable
- get comma-separated category IDs in a variable
- write a WP_Query arguments array
- 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.
Edit the Template that applies to single blog posts with Oxygen.
Add a Section.
Add a Code Block inside.
PHP & HTML:
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.