Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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.

share|improve this question
2  
Read codex.wordpress.org/Template_Hierarchy. That should answer all these questions. –  toscho Apr 30 '13 at 22:00
add comment

1 Answer

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

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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