If in parent category

The is_category Conditional Tag checks if a Category archive page is being displayed – hence it is expected to return false on single post pages, whether the post in question is in said category or not.

To check for the latter condition, make use of has_category. If you want the content to show up on category as well as single post pages (in the category), combine the two:

if ( is_category( 'catering' ) || has_category( 'catering' ) ) {
     // display something
}

Leave a Comment