[Resolved] How to remove category archive title (but keep the category description)

Home Forums Support [Resolved] How to remove category archive title (but keep the category description)

Home Forums Support How to remove category archive title (but keep the category description)

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #2242946
    Al

    Hello!
    I need to remove the default title from Category archives. I tried the snippet on this forum post: https://generatepress.com/forums/topic/remove-the-title-on-category-archive-pages/

    add_action( ‘after_setup_theme’, function() {
    remove_action( ‘generate_archive_title’, ‘generate_archive_title’ );
    } );

    The suggested snippet works great for removing the title – but it also removes the category description along with it, which I need to keep. Is there a way to remove only the title, without having to hide it via CSS?

    Secondarily, is it possible to have it only apply to the category archives and not date or author-based archives? That’s not mission-critical, but would be nice.

    Thanks!

    #2243489
    David
    Staff
    Customer Support

    Hi there,

    try this PHP Snippet:

    add_action('wp', function(){
        if ( is_category() ) {
            remove_action( 'generate_archive_title', 'generate_archive_title' );
            add_action( 'generate_archive_title', 'generate_do_archive_description' );
        }
    });
    #2301695
    Al

    Hm, I could have sworn I replied to this, but I guess not. Thank you, David! That snippet worked great.

    #2301764
    David
    Staff
    Customer Support

    Glad to hear that!

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