Hide section with post widget
-
Hello,
I’m trying to hide a section on a page that contains a post widget for a CPT when that widget has no results for the posts it fetches.
I figured between this and Dynamic Conditions I’d be able to get it working but haven’t figured out the recipe yet.
The post widget gets posts from the CPT when the posts taxonomy name matches the page title. For example, the page is Alabama and it pulls all the CPTs that have the taxonomy Alabama. However there are states (in this example) that don’t have any associated posts so I’d like to hide the section and display a different section.
I was thinking the NumberPostsQuery might do the trick but not sure how to set it and if it can have a variable. So:
posttype: nonprofit
taxonomy: nonprofit_state
taxonomy field: name
term: get_the_title()Guidance appreciated.
- The topic ‘Hide section with post widget’ is closed to new replies.