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?

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

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

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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