Support » Theme: Reykjavik » Change page header html title tag

  • Resolved gregvlahokostas

    (@gregvlahokostas)


    Hello,
    i’m trying to change page’s html title tag from h1 to h2
    Page’s / title’s code:

    <div id="content" class="site-content">
    <section id="intro-container" class="entry-header intro-container">
    
    	
    	<div id="intro" class="intro"><div class="intro-inner">
    
    		<h1 class="page-title h1 intro-title"> - THIS TITLE HAS TO CHANGE - </h1>
    	</div></div>
    </section>
    <div class="site-content-inner">
    	<div id="primary" class="content-area">
    		<main id="main" class="site-main">
    <article id="post-641" class="post-641 page type-page status-publish hentry entry">
    <!-- Article content here ->
    </article>
    		</main><!-- /#main -->
    	</div><!-- /#primary -->
    </div><!-- /.site-content-inner -->
    </div>

    I just can’t find the right file to edit this html tag.
    Could you please tell me wich files should i find so as to change page’s title html tag?
    I already use a child theme, so if there is a way to override parent’s theme code, this would be great instead of tweaking directly parent’s theme

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi,

    Please note that H1 tag is only used on homepage as it should. On other pages the tag is actually P (paragraph) and H1 is reserved for the page title there.

    If you really need to change this behavior, you can copy the templates/parts/header/site-branding.php file into your child theme (keeping the subfolder structure) and edit it there.

    Best regards,

    Oliver

    Oh, sorry, now I can see you are actually talking about the page intro section title.

    You can do so using this code in your child theme’s functions.php file:

    function child_theme_intro_title_tag( $tag, $post_id ) {
      return 'h2';
    }
    add_filter( 'wmhook_reykjavik_intro_title_tag', 'child_theme_intro_title_tag', 10, 2 );

    (Adapt the code to your needs.)

    Worked like a charm!
    Thank you very much for your quick response! Add me to your fan’s list 🙂

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Change page header html title tag’ is closed to new replies.