• Hey – trying to get rid of “Category:” from category page headers across the site.

    Every answer I’ve found says to add this code to the functions.php file, but it doesn’t work.

    Any ideas for how to remove this?

    CODE:

    function prefix_category_title( $title ) {
    if ( is_category() ) {
    $title = single_cat_title( ”, false );
    }
    return $title;
    }
    add_filter( ‘get_the_archive_title’, ‘prefix_category_title’ );

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi,
    Please add these code in your theme’s functions.php file.

    add_filter( 'get_the_archive_title', 'newseqo_archive_title');
    
    function newseqo_archive_title(){
    	if ( is_category() ) {    
    		$title = single_cat_title( '', false );    
    	} elseif ( is_tag() ) {    
    		$title = single_tag_title( '', false );    
    	} elseif ( is_author() ) {    
    		$title = get_the_author();    
    	} elseif(is_archive()){
    		if(is_day()){
    			$title = get_the_date();	
    		}elseif(is_month()){
    			$title = get_the_date('F Y');
    		} elseif(is_year()){
    			$title = get_the_date('Y');
    		}else{
    			$title = esc_html__('Archives', 'newseqo');
    		}
    	}elseif ( is_tax() ) { //for custom post types
    		$title = sprintf( __( '%1$s' ), single_term_title( '', false ) );
    	} elseif (is_post_type_archive()) {
    		$title = post_type_archive_title( '', false );
    	}
    	return $title; 
    }

    Hope this will work perfectly.
    Thanks

    Thread Starter alexongftl

    (@alexongftl)

    Thanks for helping! Have added that and unfortunately it doesn’t work.

    Can i just add it to the bottom of the Functions.php file or does it need to go within there somewhere?

    Hello,
    I have checked your reference link and seems you have turn off the banner part from admin panel->appearance->customize->banner, that’s why above code was not working. You need to copy the following file (newseqo->template-parts->blog->category->parts->cat-title.php) from parent theme and paste it in child theme with same path like (newseqo-child->template-parts->blog->category->parts->cat-title.php) and then edit this file. Here the text is showing and you need to remove it. Please see screenshot https://prnt.sc/up16is .

    Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Removing “Category:” from Category Pages’ is closed to new replies.