I have created a popup template that pulls dynamic data from a custom post type. I would like to have the popup only show if there is a published post in that CPT. If there are no published posts, the popup should not display at all.
I have added a condition to the outer element (section) in my popup template, which hides the popup content if there are no posts available. However, the popup backdrop still displays even though there is no content, and you have to click to dismiss it and browse the site. How can I completely disable the popup if there are no published posts?