Skip to content

Snippet: Change the Page Header Title h1 tag to something else

The page header title file in the Total theme is located at partials/page-header-title.php but if you want to alter something so simple as the html tag it's best to use the wpex_page_header_title_args arguments. The following snippet is an example of how you can change the default h1 tag around the page header title to an h2 tag. Feel free to use any conditionals in the code if you want to change the markup depending on the current page or section of the site.

// Alter the page header title arguments
add_filter( 'wpex_page_header_title_args', function( $args ) {
	$args['html_tag'] = 'h2';
	return $args;
}, 40 );
All PHP snippets should be added via child theme's functions.php file or via a plugin. We recommend Code Snippets (100% Free) or WPCode (sponsored)
Back To Top