bhadaway / blankslate

A naked WordPress theme, powering over 10k websites. Buy me a sandwich. 🥪
https://opencollective.com/blankslate
328 stars 92 forks source link

Please help me understand why this is here #53

Closed mrlowe closed 1 year ago

mrlowe commented 1 year ago

I'm not very well-acquainted with either WordPress or PHP, so I'm trying to understand the dark and dreadful reason that these if-statements make sense:

https://github.com/tidythemes/blankslate/blob/master/header.php#L15-L17

Could someone enlighten me?

bhadaway commented 1 year ago

This is for the purpose of proper headers and SEO.

If you're on the blog page, where there's a list of post titles, the site title will be h1 and the post titles will be h2. If you're on a single post, the title of the post is now the h1 header.

mrlowe commented 1 year ago

@bhadaway thanks for your response! I guess what I mean is, is there some deep secret about wordpress or PHP that makes this:

if ( is_front_page() || is_home() || is_front_page() && is_home() )

in any way different from this:

if ( is_front_page() || is_home() )

bhadaway commented 1 year ago

This is due to the many variables of what a "homepage" can be in the WordPress infrastructure.

So, to most humans, the main, default homepage of a website is https://github.com/, without anything tacked on the end. However, in WordPress, there's no native, one-size-fits-all approach to declaring that.

Home, front, and blog/posts page can all be set to https://github.com/, and are declared in different ways. I understand why it's confusing, but hopefully that sheds a little light.