Change the post title tag to h2

⚠️ 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.

In the Customizr WordPress theme, you can easily change the default h1 html tag of the post or page title with the ‘tc_content_title_tag’ filter.

The quick example below illustrates how to change every post of page title to h2 (instead of the default h1)

add_filter('tc_content_title_tag' , 'my_title_tag');
function my_title_tag() {
    return 'h2';
}

You can be more specific and use the WordPress conditional tags

 

Where to paste this code? => in your functions.php file. I strongly recommend to 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 Ivan Schustak Cancel reply

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

8 thoughts on “Change the post title tag to h2”