Resolved

Remove word "Category" from title of category page

Ultra Theme started by Rutger Mar 6, 2017 3 replies
Rutger Mar 6, 2017 · 6:15 pm #6011

Hi there,

Just on the brink of launching my website, but I do have one more question. I haven’t been able to find the answer on general WordPress discussions online – and hoped perhaps you are able to help out.

I use multiple categories of messages and use a category page to display all my messages of the ‘news’ variety: see: http://demodernetijd.nl/nieuws/. This works fine, but I would like my page to say “News” rather than “Category: News” in the page title. Is there a way to remove the text “Category: ” (my page is in Dutch, so actually ‘Categorie: “)?

Best wishes,

Rutger

Andrew Misplon Puro Mar 6, 2017 · 11:22 pm #6013

Hi Rutger

Thanks for posting. Sure, we can edit the prefix, please, try the following:

1. Plugins > Add New, search for and install: Code Snippets.
2. Go to Snippets > Add New, name the snippet as required and insert into the body:

function ultra_archive_title( $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;
}
add_filter( 'get_the_archive_title', 'ultra_archive_title' );

Scroll to the bottom of the page and enable the option labelled: Only run on site front-end. Finally, click Save changes and activate.

Hope that helps.

Rutger Mar 7, 2017 · 12:08 am #6014

Dear Andrew,

This is marvellous, couldn’t possibly have come up with this myself. Many thanks!!

Best wishes,

Rutger

Andrew Misplon Puro Mar 7, 2017 · 12:10 am #6015

Super 🙂 Glad to hear that did the trick. Chat soon. Cheers.

4 posts