Site logo

Archived topic

Disable page header for CPT archive only

5 replies · Started by Alexander on August 28, 2019

Viewing posts 1–6 of 6

Hi,

I'm using a CPT for my photo portfolios - actually a leftover from my previous theme. The archive for those is https://www.alex-kunz.com/portfolio/ and I'd like to keep using it.

(note: I found how to enable columns for that archive and change the number of columns in the documentation; I also extended that to include the portfolio category and portfolio tag archives thanks to previous support questions - you guys are doing a great job here!)

This archive display is now (almost) good enough for me - I just would like to replace the page header "Archive: Portfolio" with "Photographic Portfolios" or, if replacing it isn't possible, simply hide it (I tried a Layout Element but there's no option to hide the Page Header). Semantics matter. ;-)

I tried searching but still... haven't found... what I'm looking for...

Thanks for your help
Alexander.

Hi there,

You can use this CSS to hide it:

.archive .page-header {
    display: none;
}

Let me know if this helps :)

Thank you, Leo. That would hide it from all archive pages though, wouldn't it? I want to hide or replace the header only from the portfolio CPT archive (or better yet, replace the words). I'd like to keep the header for the other archives.

Hi there,

Let's give this a shot:

add_action( 'wp', function() {
    if ( is_post_type_archive( 'portfolio' ) ) {
        remove_action( 'generate_archive_title', 'generate_archive_title' );
    }
} );

Adding PHP: https://docs.generatepress.com/article/adding-php/

Let me know :)

That worked, thank you!

You're welcome :)

This archived topic is closed to new replies.