WordPress front page logic is a mess. No — a Mess. :)
It is an old artifact of development, from the time when WP started to break away from purely blogging paradigm. The static front page functionality was added, but in quite an awkward way.
I have stumbled over this innumerable times and finally decided to note down how it works once and for all.
Front page cheatsheet
|Default||Static front page|
|Front page displays||Your latest posts||Front page: Front||Posts page: Posts|
|URL||example.com (site URL)||example.com/posts (page URL)|
|Body classes||- ||- |
|Loop and content||posts index||page||posts index|
|Front page ID|
|Posts page ID|
What is home?
The one especially confusing mismatch to note is that home is all over the place.
home body class and
home_url() function refer to front page. They mean location in site (Site URL).
home.php template and
is_home conditional refer to posts index. They mean type of page in site (blog posts).
Front page template
front-page.php template is great for very custom front pages. Since it has high priority in both cases of template hierarchy — it is hard to override and publicly released themes rarely include it.
Be aware of it for custom builds, it makes things easier for them.
Default front page behaves as combination of front page and blog posts archive.
Static front page resides at front page location and behaves as a page.
Posts page resides at assigned page’s location, but behaves as a blog posts index (it being a page is mostly ignored).
In a nutshell you use:
- static front page to customize, moving archive from there;
- posts page to change location of posts archive.