Filtering Posts by Taxonomy Terms in Oxygen
This members-only tutorial provides the steps to limit the posts output by a Oxygen's Easy Posts or Repeater component on singular entries of another post type to only those that belong to the terms selected using ACF's Taxonomy custom field.
tutor Custom Post Type uses the standard WordPress categories Ex.: Maths, Science, Geography.
Advanced Custom Fields field group has a
tutor_category_selector custom field of type Taxonomy set to appear on regular Posts.
When editing a Post, Maths and Science are ticked.
The objective is to show a section on singular posts that shows all the tutors that are filtered by the selected categories.
If you have not already, register your CPT using a plugin like CPT UI or otherwise, tick support for categories and add a few entries while setting some categories.
Add your field group.
Leave the Return Value as Term ID.
In your post edit screens, select the taxonomy terms that the current post should be "related to".
Edit the Oxygen Template that applies to singular posts.
Add a Section.
Add a Easy Posts or Repeater.
Set to Query to custom (or manual, if you prefer that) and select/set your Post Type and optionally, the Count or posts_per_page.
Add a Code Block above the Easy Posts/Repeater.
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.