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.
8 thoughts on “Change the post title tag to h2”
Any idea how to change the post titles on Archive/category pages from h1 to h2; and not on the post page itself?
I’m trying to just take out the .format-icon. How do I do that? I tried overwriting the css to have the font-family to something else but that didn’t work. I just want to take out .format-icon in the html. How do I do that?
Hi Lee, you can use filters to remove them : tc_content_title_icon and tc_archive_icon.
Paste this code in your functions.php file and you are done
This didn’t work for me. I am trying to make the Post Titles on my posts landing page smaller. Here’s my draft site if that helps!
http://southarts.schustak.com/about-us/press-center/
Thanks in advance!
You can easily target your title with CSS. For example setting the font-size to 22px is done with the following code
That changed all of my post and page titles throughout the site to a smaller size. Is there any way to just adjust the size on the page listing all of my posts?
Yes of course, you can target any type of content on your website with the WordPress body classes : http://codex.wordpress.org/Function_Reference/body_class
And how about adding
to this funky bunch ?