My theme has a title bar below the menu. The title bar displays the Title and a breadcrumbs menu. The code is in a template file called title-bar.php. The title bar now shows up on all pages and on all posts.

I want this title bar only to show up on all my custom post type archive pages, but hide it on all other pages and on all single posts including custom post types.

How can I do this?

IF page type is ARCHIVE: (code for title bar)

ELSE: (empty)


You can use is_post_type_archive(), which is one of the many conditional tags in WordPress:

if ( is_post_type_archive( 'your_post_type' ) ) {
  // show the title bar
// else, just do nothing
  • 1
    This works great. Thank you! – HAL2020 Apr 7 '20 at 23:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.