Conditional category post widget not appearing
-
I’m adding a widget area to the end of posts, and I’m trying to use a category conditional tag but it’s not working. I read in the codex how to use operators for multiple conditions by using
&&
, but when trying it’s not working.I have a test post with a category of “test”. When I use a conditional state of:
if ( is_single() )
…the widget area shows up on all posts regardless of category. Now when I try this:
if ( is_single() && is_category('test') )
… the test widget disappears and doesn’t show up on my test post or any post. This makes no sense. Here is the full function with the attempt at a category conditional, for reference…
add_action( 'genesis_after_entry', 'sb_after_entry_widget_area', 5 ); function sb_after_entry_widget_area () { // conditional for archives if ( is_single() && is_category('test') ) : ?> <div class="after-content-ad-space"> <?php if ( is_active_sidebar( 'printables-mailing-list' ) ) : ?> <?php dynamic_sidebar( 'printables-mailing-list' ); ?> <?php endif; ?> </div><!-- .footer-ad-area--><?php endif; }
The page I need help with: [log in to see the link]
- The topic ‘Conditional category post widget not appearing’ is closed to new replies.