WordPress Home Page is the main page, a visitor navigating to a website from a web search engine will see, and it may also serve as a landing page to attract visitors.
A home page is used to facilitate navigation to other pages on the site by providing links to prioritized and recent articles and pages, and possibly a search box.
By default, a WordPress website shows a homepage with your latest posts listed in reverse chronological order. However, users can choose to use a static page as their custom home page. This will make the website feel less like a blog and more like a fully featured website.
The home page is dependent on the site’s “Front page displays” Reading Settings ‘show_on_front’ and ‘page_for_posts’.
If a static page is set for the front page of the site, it will return true only on the page you set as a “Posts page”.
Homepage Settings
Using the conditional functions, you can check if the homepage is being displayed or if the homepage is using a static page, i.e (is_home) or (is_front_page) respectively.
This behavior can be defined in the reading section of the settings. You may use these functions in your WordPress plugin or WordPress theme, to display or change contents depending on the user settings.
But you always need to keep on mind the static blog page, when you define a static page for your homepage. You can also define a blog page to replace the default WordPress homepage in order to list every post.
To make your long story short: is_front_page should always be tested with and before is_home. And below here’s given why.
Normal Settings:
Your latest posts are listed down by the default WordPress homepage
- The URL is: website.com
- Is_home returns TRUE
- Is_front_page returns TRUE
There isn’t an issue
Static Homepage:
When the homepage is using one of your static pages.
- The URL is still website.com
- is_home returns FALSE
- is_front_page returns TRUE
There is no issue with your static homepage if it returns is_return_page TRUE.
Static Block Page:
Such that one of your pages is listing all your post.
- The URL is website.com/pagename
- is_home: TRUE
- is_front_page : FALSE
Here, you might get some problems i.e: is_home is returning TRUE, but this is not your homepage: it’s a WordPress page that lists every post as a main category archive would do.
How to create your Homepage
- Go to My Sites → Pages and Add. Stick in a bit of placeholder text according to your wish
- Now, create a second blank page by going once again to My Sites → Pages, then Add and give it any name like “News,” or “Blog,” or “Posts” that will help you remember that this is the page on which your posts will appear.
To designate your static homepage, go to My Sites and customize the Homepage Settings:
Now, go to the Front page displays, choose a static page. Then, click on the Homepage dropdown list and select the “Home” page that you created as your static homepage:
After that from the Posts page dropdown, select the “Posts” page that you have created.
And lastly, click on Publish for these changes to take place. And your WebPage is up and ready.