Customize Heading Tags (SEO purposes)

In this article you can find code snippets that will help you customize the heading tags throughout various positions in the theme.

To use them, first you’ll need to install Kallyas Child theme. With your favorite editor, open theĀ child theme’s functions.php file (/kallyas-child/functions.php) and paste some of these codes.

Override Logo’s heading wrapper (H1)#

By default as per various sources online, Kallyas theme on Frontpage wraps the logo into a h1 tag and for the rest of the pages into an h3 . The discussion is rather controversial and there are various opinions on this one. Luckily there’s an easy way to change this:

function wp2356_change_logo_tag() {
  return 'div';
}
add_filter( 'zn_logo_tag', 'wp2356_change_logo_tag', 50 );

You can add any tag you want, in this example it’ll replace with a div, however you can add any tag you want.

Override Subheader’s heading tag:#

By default the headings are h2 for Title and h4 for Subtitle. To override the title’s tag, use this code:

function mysite0123_change_subheader_title_tag() {
   return 'h3';
}
add_filter('zn_subheader_title_tag', 'mysite0123_change_subheader_title_tag');

And for the subtitle’s tag, use this code:

function mysite0123_change_subheader_subtitle_tag() {
   return 'h5';
}
add_filter('zn_subheader_subtitle_tag', 'mysite0123_change_subheader_subtitle_tag');

Override Posts title tag in Blog Archives:#

By default the blog archive headings are h3. To override the title’s tag, use this code:

function wp2356_blog_archive_title_tag() {
  return 'h3';
}
add_action( 'zn_blog_archive_titletag', 'wp2356_blog_archive_title_tag' );

Override sidebar widgets title tag:#

By default the sidebar widget titles are h3. To override the title’s tag, use this code:

function wp2356_sidebar_widget_title_tag() {
  return 'h3';
}
add_action( 'zn_sidebar_widget_title_tag', 'wp2356_sidebar_widget_title_tag' );

By default the footer sidebar widget titles are h3. To override the title’s tag, use this code:

function wp2356_footer_sidebar_widget_title_tag() {
  return 'h3';
}
add_action( 'zn_footer_widget_title_tag', 'wp2356_footer_sidebar_widget_title_tag' );