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 (one-time payment for lifetime access).

Already a member? Log in below or here.

Need help implementing a tutorial in your site or want to hire me for custom work?

HIRE ME

Find the article helpful and wish to donate?

DONATE

Comments

For adding code blocks wrap the code in three backticks. Markdown should work.
Provide a URL of your site/webpage if something is not working.
>
linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram
%d bloggers like this: