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

[Condition] CPT Has Published Entry?

Sridhar Katakam

This members-only tutorial provides the code to add a custom condition in Oxygen to ensure that element(s) to which the condition is applied to will only be output when the specified post type has at least one published post.

Use Case Example: You have a Section containing a "Testimonials" heading and a bunch of testimonial CPT entries using Easy Posts component below it. Now you want to ensure that this Section appears only when there is at least 1 published testimonial.

Simply add the code below as a Code Snippet and apply the condition.

Go to Snippets > Add New.

Title: Condition: CPT Has Published Entry?

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