Changing the title of the categories archive pages

⚠️ Code snippets might not be compatible with the latest version of your theme. Always use a child theme to customize your theme, and test your code on a staging website before migrating to production.

Customizr includes some useful filters if you need to customize your category archives titles.

 

Changing the default prefix : “Category Archives :”

add_filter('tc_category_archive_title' , 'my_cat_title');
function my_cat_title($title) {
	return 'My archives title for : ';
}

 

Changing the heading of a specific category’s archives page

Note : A new set of options has been included since Customizr 3.3.14 and Customizr-Pro 1.1.0 to change Category/Tag/Author/Search archives titles. Navigate to Appearance -> Customize -> Content : home, posts, grid, … -> Post lists : blog, archives, grid, … -> ARCHIVE TITLES and enjoy customize them in a live preview!

Just replace “my_cat_name” with the name of the desired category.

add_filter('tc_category_archive_header_content' , 'my_cat_heading');
function my_cat_heading($content) {
	global $wp_query;
	if ( 'my_cat_name' != $wp_query -> query_vars['category_name'] )
		return $content;

	return '<h1 class="my_custom_class">My custom title</h1>';
}

 

Where to copy/paste this code? The following code has to be pasted in your functions.php file. I strongly recommend that you create a child theme. Download a start-up child theme here.

Everything you need to know about child theme with Customizr here.

Leave a Reply to Stacey Cancel reply

Your email address will not be published. Required fields are marked *

20 thoughts on “Changing the title of the categories archive pages”