1

When I open up my WordPress site, and on the admin - settings - reading I define Your home page display posts as "Your latest posts" The homepage is displayed by home.php and /blog/ is displayed by blog.php. When I change the "Your homepage displays" as "static page" and select Homepage as "home" page and blog as "blog" page, the /blog shows the home.php page and the homepage shows the page.php page. Why is that?

1 Answer 1

0

WordPress started as an outright blogging platform and nothing more, so the home page was always just meant to be the most recent blog entries, in its early iterations.

The template hierarchy has evolved since then but a lot of the labels have remained from that era. (Backwards compatibility and such.) So the page.php file was a later addition to WP and home.php file was the default (as a blog feed) because that was how WP started out. You can check out the full hierarchy here.

https://developer.wordpress.org/themes/basics/template-hierarchy/

In short, because of legacy, home.php in a theme assumes that you're looking at the front page of a site that is set to having it's posts listed on it. (Like original WP.)

If you change it to static, WordPress then interprets that as you NOT wanting your front page to be a list of posts, so instead it assigns the default page.php template so that you can layout content however you see fit.

Additional templates you can have include front-page.php which overrides home.php, but you can also make whatever templates you like, for example: gorilla-ears.php and then you can assign that to the page you've set as HOME in the WP Settings. And that page can have whatever mark-up and code you want it to have.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.