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

[Function] Get Post Count for a Given Taxonomy and Term

Sridhar Katakam

This members-only tutorial provides the steps to register a custom function that takes in the taxonomy name and term slug as inputs and returns the number of matching posts.

This can be used for example, with Oxygen's Dynamic Data condition to conditionally output elements only when there is at least 1 published post with the matching taxonomy and term.

Use Case: Let's say there's a taxonomy called industry for which one of the terms is manufacturing we can use the function to get the number of manufacturing industry posts and use this in a condition applied to a Section having a heading and Easy Posts/Repeater.

Step 1

Install and activate Code Snippets plugin.

Go to Snippets > Add New.

Title: [Function] Get post count for provided taxonomy and term


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.