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

Conditional Taxonomy Terms in Search Results in Oxygen

Sridhar Katakam

This members-only tutorial provides the steps to include posts from Custom Post Types in search results and showing the unlinked comma-separated taxonomy terms depending on the post type of each entry when using Oxygen.

Ex.:

post posts will show category terms
movie posts will show movie_category terms
event posts will show event_type terms

Step 1

If you have not already, add a search form perhaps in a Header Row in the Header Builder.

Step 2

Install and activate Code Snippets plugin.

Go to Snippets > Add New.

Title: Add support for HTML5 markup

Code:

add_theme_support( 'html5', array( 'comment-list', 'comment-form', 'search-form', 'gallery', 'caption' ) );

Save changes and activate.

Add another snippet to have the search results be limited to your desired post types.

Title: Custom Search Form

Code:

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.

tagschevron-leftchevron-rightchainangle-rightangle-upangle-downfolder-omagnifiercrossmenuchevron-downarrow-right