Published on January 15, 2020

Dynamic Data Condition in Oxygen based on post count for a given CPT, taxonomy and term slug

Sridhar Katakam

This members-only tutorial provides the steps to define a custom function that takes in 3 arguments - post type, taxonomy and term and returns the number of published entries so we can use it in the PHP Function Return value options of Dynamic Data condition in Oxygen.

Sample Use Case: Output a Section only if there is at least 1 published post of a CPT (say, portfolio) for a given taxonomy (say, portfolio_category) and term (say, logos).

Step 1

Install and activate Code Snippets plugin.

Go to Snippets > Add New.

Title: Get post count for a given CPT, taxonomy and term slug

Code:

This is a premium members-only content.

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

Already a member? Log in below or here.

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