[Resolved] Disable page header for CPT archive only

Home Forums Support [Resolved] Disable page header for CPT archive only

Home Forums Support Disable page header for CPT archive only

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #995895
    Alexander

    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.

    #995901
    Leo
    Staff
    Customer Support

    Hi there,

    You can use this CSS to hide it:

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

    Let me know if this helps πŸ™‚

    #995914
    Alexander

    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.

    #996538
    Tom
    Lead Developer
    Lead Developer

    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 πŸ™‚

    #996549
    Alexander

    That worked, thank you!

    #996824
    Tom
    Lead Developer
    Lead Developer

    You’re welcome πŸ™‚

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.