2

I was watching a WordPress course, the explainer has page.php and index.php theme template files. Which means the page.php must load the home page, but the home page is loaded with index.php!

I used his same files, but I have page.php loading the home page! How does his setup override it but mine doesn't?

1
  • The real homepage is loaded as front-page.php. If it's not available to load, then WordPress will move onto index.php instead.
    – Johansson
    CommentedApr 1, 2017 at 18:40

1 Answer 1

4

WordPress Template Hierarchy:

You should read about WordPress template hierarchy.

This question also has some related answers.

Typical Case:

In your case, the most likely scenario is:

The explainer had set the latest posts as the home page (this is the default option) and you have set a static front page as home page. Since his is blog archive, it's being loaded by index.php and yours is a page, so that's being loaded by page.php.

This is just a typical scenario, but there may be other settings that are affecting which template file is being loaded.

Changing the default setting:

If the above is your scenario, then changing the following setting from WordPress wp-admin -> Settings -> Reading -> Your latest posts (then Save Changes) will make it the same for you and the explainer. Check the screenshot below:

enter image description here

3
  • Thanks but you get it wrong, mine get loaded by page.php and his with index.php
    – Ashley
    CommentedApr 1, 2017 at 18:37
  • Well man you're rock, but how I can set the home page like him ?
    – Ashley
    CommentedApr 1, 2017 at 19:44
  • Well of course bro, I just new to this site .
    – Ashley
    CommentedApr 3, 2017 at 15:18

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.