Remove "Category:" Text From Title

I’ve seen a couple other posts like this, but nothing is working. All I’m trying to do is remove the “Category:” text from the archive page title. Here’s the page as of 2015/12/30:

http://doodl.us/category/news/

Working from a child directory, I’ve tried editing the inc > template-tags.php file by changing line 126-189, clearing the cache, restarting my computer, but nothing seems to work. Here’s what that section looks like:

if ( ! function_exists( 'the_archive_title' ) ) :
/**
 * Shim for <code>the_archive_title()</code>.
 *
 * Display the archive title based on the queried object.
 *
 * @todo Remove this function when WordPress 4.3 is released.
 *
 * @param string $before Optional. Content to prepend to the title. Default empty.
 * @param string $after  Optional. Content to append to the title. Default empty.
 */
function the_archive_title( $before = '', $after = '' ) {
	if ( is_category() ) {
		$title = sprintf( __( 'Category: %s', 'intro' ), single_cat_title( '', false ) );
	} elseif ( is_tag() ) {
		$title = sprintf( __( 'Tag: %s', 'intro' ), single_tag_title( '', false ) );
	} elseif ( is_author() ) {
		$title = sprintf( __( 'Author: %s', 'intro' ), '<span class="vcard">' . get_the_author() . '</span>' );
	} elseif ( is_year() ) {
		$title = sprintf( __( 'Year: %s', 'intro' ), get_the_date( _x( 'Y', 'yearly archives date format', 'intro' ) ) );
	} elseif ( is_month() ) {
		$title = sprintf( __( 'Month: %s', 'intro' ), get_the_date( _x( 'F Y', 'monthly archives date format', 'intro' ) ) );
	} elseif ( is_day() ) {
		$title = sprintf( __( 'Day: %s', 'intro' ), get_the_date( _x( 'F j, Y', 'daily archives date format', 'intro' ) ) );
	} elseif ( is_tax( 'post_format', 'post-format-aside' ) ) {
		$title = _x( 'Asides', 'post format archive title', 'intro' );
	} elseif ( is_tax( 'post_format', 'post-format-gallery' ) ) {
		$title = _x( 'Galleries', 'post format archive title', 'intro' );
	} elseif ( is_tax( 'post_format', 'post-format-image' ) ) {
		$title = _x( 'Images', 'post format archive title', 'intro' );
	} elseif ( is_tax( 'post_format', 'post-format-video' ) ) {
		$title = _x( 'Videos', 'post format archive title', 'intro' );
	} elseif ( is_tax( 'post_format', 'post-format-quote' ) ) {
		$title = _x( 'Quotes', 'post format archive title', 'intro' );
	} elseif ( is_tax( 'post_format', 'post-format-link' ) ) {
		$title = _x( 'Links', 'post format archive title', 'intro' );
	} elseif ( is_tax( 'post_format', 'post-format-status' ) ) {
		$title = _x( 'Statuses', 'post format archive title', 'intro' );
	} elseif ( is_tax( 'post_format', 'post-format-audio' ) ) {
		$title = _x( 'Audio', 'post format archive title', 'intro' );
	} elseif ( is_tax( 'post_format', 'post-format-chat' ) ) {
		$title = _x( 'Chats', 'post format archive title', 'intro' );
	} elseif ( is_post_type_archive() ) {
		$title = sprintf( __( 'Archive: %s', 'intro' ), post_type_archive_title( '', false ) );
	} elseif ( is_tax() ) {
		$tax = get_taxonomy( get_queried_object()->taxonomy );
		/* translators: 1: Taxonomy singular name, 2: Current taxonomy term */
		$title = sprintf( __( '%1$s: %2$s', 'intro' ), $tax->labels->singular_name, single_term_title( '', false ) );
	} else {
		$title = __( 'Archives', 'intro' );
	}

	/**
	 * Filter the archive title.
	 *
	 * @param string $title Archive title to be displayed.
	 */
	$title = apply_filters( 'get_the_archive_title', $title );

	if ( ! empty( $title ) ) {
		echo $before . $title . $after;
	}
}
endif;

Am I missing something? Am I even looking in the right spot? I do want the category name to stay, just remove the text that says “Category:”

Thanks for any info. Best Regards, Kevin

Hi Kevin,

Sorry for late response.

To remove the “Category” word, please follow the steps below:

  1. create a child theme
  2. duplicate archive.php from parent theme to the child theme
  3. open archive.php and change this line:
    the_archive_title( '<h1 class="page-title">', '</h1>' );
    to:
    echo '<h1 class="page-title">';single_cat_title();echo '</h1>';
    http://prntscr.com/9m7vt8

Regards,
Awan

So I was looking in the wrong spot. Glad someone knows all the functions :slight_smile: Thank you. This thread is resolved.

1 Like

Awan, you have no idea how long I have spent trying to find how to do this. So glad I found your page, it worked a charm! :slight_smile:

A wonderful themes blog. I would love to come back and look at other best themes in this blog. I have been using one of the best themes from this website on my movies app blog, showboxappdownloads & Goodervideo.

Thanks,
Robert.

Your support forum is amazing solves all the queries regarding the themes. I have been using your themes on my sites ( Bobibanking ) and I have had a great experience.

Thanks a lot just added your theme on one more site of mine ( Kotak Net Banking and PNB Net Banking ) and also to PNB your theme seems amazing to me.