Sydney Wordpress theme and child theme

I have a Sydney child theme installed as well. My homepage has no header 1 element. I want to add the h1 element as this is very important for SEO. Where and how do I add this element to my theme. Also is there anyone else who has found this issue and fixed it here?.

  • chris muratti

    Great to hear from you so soon. I am using 4.7.3 Sydney child theme James. In my Theme Header header.php i have this code:
    <h1 class="site-title">" rel="home"><?php bloginfo( 'name' ); ?></h1>
    However when I check with various different SEO sites they all tell me the same thing. That my website uses no H1 element.
    Furthermore, when I right click on my site to view the page and hit control and f and input <H1 there is none to be found.
    I only want an <H1 element for my home page and want my other pages to have their own <H1 element.
    I hope you can help me resolve this issue with this theme. It is a very popular one and I am certain it will help many people. Thanks for your time James.

  • James Morris

    Hello chris muratti,

    Hmmm... Your code and it's placement seem correct. This is odd that it's not displaying. It's as though the correct file is not being loaded.

    In order to help you better with your issue, would you please grant me access to your site?

    You can learn how to grant WPMU DEV Support Access at the following link:

    https://premium.wpmudev.org/docs/getting-started/getting-support/#chapter-4

    Please reply back here once you've enabled access so I will be notified.

    Best regards,

    James Morris

  • James Morris

    Hello chris muratti,

    I'm terribly sorry for the late reply here.

    The first problem I'm seeing is that you made the changes to the parent theme's header.php. With the next update of this theme, this change will likely be overwritten. You should copy header.php from the parent theme into the child theme's folder. That way, any modifications you make will not get changed on update.

    Second, the logic of the theme defines that, if there is a logo, that will be displayed, else the H1 tag and title will be displayed.

    See:

    <?php if ( get_theme_mod('site_logo') ) : ?>
    	<a href="<?php echo esc_url( home_url( '/' ) ); ?>" title="<?php bloginfo('name'); ?>"><img class="site-logo" src="<?php echo esc_url(get_theme_mod('site_logo')); ?>" alt="<?php bloginfo('name'); ?>" /></a>
    <?php else : ?>
    	<h1 class="site-title"><a href="<?php echo esc_url( home_url( '/' ) ); ?>" rel="home"><?php bloginfo( 'name' ); ?></a></h1>
    	<h2 class="site-description"><?php bloginfo( 'description' ); ?></h2>
    <?php endif; ?>

    On order to add a h1 to every page, you're going to need to copy over each template and modify the h2 elements and change them to h1 elements.

    For example, in content.php
    Change:
    <?php the_title( sprintf( '<h2 class="title-post entry-title"><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a></h2>' ); ?>

    To:
    <?php the_title( sprintf( '<h1 class="title-post entry-title"><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a></h1>' ); ?>

    Since the post/page title is the topic of the page, this would be the best way to go.

    I hope this clarifies a bit.

    Bet regards,

    James Morris

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.