Skip to content

Instantly share code, notes, and snippets.

View thomasjulienalain's full-sized avatar

Julien Thomas thomasjulienalain

View GitHub Profile
@thomasjulienalain
thomasjulienalain / oxygen-repeater-dynamic-query.php
Created December 6, 2020 15:07 — forked from yankiara/oxygen-repeater-dynamic-query.php
Use dynamic queries with Oxygen's repeater
/*
* Example of related posts repeater for any CPT with taxonomy:
* - Filter query to prevent altering queries inside the repeater items,
* - Retrieve post category slug : I have only one for each post, so I just take first element.
* (You might need to add error tests, of course, if you don't accept empty results,
* for instance if you forgot to set post category.)
* - Set tax_query arg with category slug
* - Set random order
* - Exclude current post
* - Deactivate pagination