WordPress / gutenberg-starter-theme

A simple theme for testing Gutenberg.
GNU General Public License v2.0
683 stars 163 forks source link

Wrong condition in header.php for `site-title` #74

Open audrasjb opened 5 years ago

audrasjb commented 5 years ago

Hi,

Thanks a lot for this theme. I'm forking it for personal purposes, and I found a mistake related to site-title in header.php.

Nothing can meet the condition below:

if ( is_front_page() && is_home() )
nate-allen commented 5 years ago

A page can meet both conditions. If the settings under Settings->Reading->Your homepage displays are left at default, the home page will return true for both is_front_page() and is_home()

This is done for SEO purposes, so the H1 tag isn't used twice on a page. Whenever posts are shown on the front page, the site title is an H1 tag. If your blog isn't the front page, an H1 tag is used with this code:

if ( is_home() && ! is_front_page() ) :
    ?>
    <header>
        <h1 class="page-title screen-reader-text"><?php single_post_title(); ?></h1>
    </header>
    <?php
endif;
audrasjb commented 5 years ago

Hi and thanks for your answer @nate-allen :)

I know it's good for SEO but this is not what I meant with this issue. See the changes I made in the related PR (#75): https://github.com/WordPress/gutenberg-starter-theme/pull/75/files

Thanks, Jb

nate-allen commented 5 years ago

@audrasjb Hmm, I don't think this is a bug though. You said:

Nothing can meet the condition below:

if ( is_front_page() && is_home() )

But the default settings (Your homepage displays your latest posts) would meet those conditions.