Site logo

Archived topic

Move archive title and description to page header

5 replies · Started by Fabien on October 24, 2020

Viewing posts 1–6 of 6

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

Thanks Tom. For now I'd like to keep my workflow (with version control) ;-)

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

Will do, thanks again and keep the great work !

No problem! :)

This archived topic is closed to new replies.