0

I'm building a WordPress theme but I'm bit confused. I don't know what to use. There is home.php, front-page.php or index.php. When I started building the WordPress theme I started with index.php and gave it this code:

<?php get_header(); ?>

after that I found that there is that 3 pages index.php, front-page.php and home.php. So I realised that I need front-page.php, from what I heard it loads first so I will use it for front page which will have news slideshow and etc. Well now here is the question, what for is index.php or home.php? Do I really need these two files? And can I use index.php as front-page? Do I really need front-page.php? Can't I just use index.php?

Thank you.

1

1 Answer 1

3

The codex on the Template Hierarchy:

  1. WordPress first determines whether it has a static front page. If a static front page has been set, then WordPress loads that page according to the page template hierarchy.

  2. If a static front page has not been set, then WordPress looks for a template file called home.php and uses it to generate the requested page.

  3. If home.php is missing, WordPress looks for a file called index.php in the active theme's directory, and uses that template to generate the page.

enter image description here

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.