[Resolved] Move archive title and description to page header

Home Forums Support [Resolved] Move archive title and description to page header

Home Forums Support Move archive title and description to page header

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1502090
    Fabien

    Hi,

    Using php function and template files, I’ve created a full width header for my categories pages.

    However, the title/description is now displayed 2 times in the page : in the header and in #content. I want to my title / description to be displayed only in the full width header.

    Using this function works but it removes the title/description everywhere :

    add_action( 'wp', function() {
        if ( is_category() ) {
            remove_action( 'generate_archive_title', 'generate_archive_title' );
        }
        if ( is_category() ) {
            add_action( 'generate_after_main_content', 'generate_do_archive_description' );
        }
    } );

    What should I do ? Stop using <?php do_action('generate_archive_title'); ?> in my header template ?

    Thanks

    #1502624
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    You’ll need to update your conditional logic to only apply to the template that you’ve added your header to.

    Have you considered using our Header Element? It will remove the default archive titles if you use {{post_title}}: https://docs.generatepress.com/article/header-element-overview/

    #1502720
    Fabien

    Thanks Tom. For now I’d like to keep my workflow (with version control) ๐Ÿ˜‰

    #1503796
    Tom
    Lead Developer
    Lead Developer

    In that case, your best bet is to update your conditions when removing the title to only apply to the necessary pages.

    #1503900
    Fabien

    Will do, thanks again and keep the great work !

    #1505098
    Tom
    Lead Developer
    Lead Developer

    No problem! ๐Ÿ™‚

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