• Resolved RB

    (@brianverner)


    How to I remove “Category:” before the category?

    Example:
    I have a category called NEWS. When I go to NEWS, “Category: NEWS” displays at the top.

    I want it to display just NEWS.

    Thank you for your help!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi,

    post your site link.

    Thread Starter RB

    (@brianverner)

    Hi,

    try add this code to functions.php, if you know more about coding so it’s a best practice to create a child theme and then add this code to the child functions.php.

    
    add_filter( 'get_the_archive_title', function ($title) {
    
        if ( is_category() ) {
    
                $title = single_cat_title( '', false );
    
            } elseif ( is_tag() ) {
    
                $title = single_tag_title( '', false );
    
            } elseif ( is_author() ) {
    
                $title = '<span class="vcard">' . get_the_author() . '</span>' ;
    
            }
    
        return $title;
    
    });
    
    
    Thread Starter RB

    (@brianverner)

    That did not work, but I played around a little bit with the functions.php file and found a fix.

    Change the bold:

    From:
    <?php the_archive_title( ‘<h2 class=”archive-title”>’, ‘</h2>’ ); ?>

    To:
    <?php single_cat_title( ‘<h2 class=”archive-title”>’, ‘</h2>’ ); ?>

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Remove "Category:" before the category.’ is closed to new replies.