What is the difference between front-page.php and home.php?

When developing a theme wordpress grant us to use front-page and home page templates, so what is the major difference between these two templates as they seems like identical. I also want to know what will be the purpose of index.php file if we have front-page.php or home.php to work like our main index file, I mean server accepts the index file to index as main page or home page so if we name the file front-page or home how it will possible for site indexing.

Related posts

1 comment

  1. In short:

    • index.php is a fallback template only, in case no appropriate template was found
    • home.php is used for the blog (a listing of recent posts)
    • front-page.php is used for the landing-page

    The universal index.php template

    The index.php template file is a fallback template. It is used as a last resort when no other more appropriate template is available. For example, if you don’t have a front-page.php nor a home.php then index.php will be used. This is also true for missing archive.php or single.php and so on.

    Regarding front-page.php VS home.php

    Now the difference between front-page.php and home.php templates is that the front-page.php is used, as its name suggests, as the main front-page of the site, while home.php is intended to be the home of the Blog section.

    What template will be used for my site’s landing-page?

    The front-page.php template, if present, will be used for the site’s main front page (e.g. http://www.example.com/). If not present, then home.php will be used instead. If both the front-page.php and home.php template files are missing then the index.php fallback template will be used.

    What template will be used for my blog page?

    WordPress allows you to have a “Blog” page (which will list recent posts) on a different page than the landing-page (e.g. http://www.example.com/blog/). So if this is the case on your site, then the Blog page will always use the home.php template. If home.php doesn’t exist then the index.php fallback template will be used.

    How to configure the landing-page and blog page?

    To configure what content to show on your front page, go to the WordPress Admin, under Tools > Reading, there you can configure the “Front page displays” to show a static page, or your latest posts.

    In the case you choose to display a static page on the front page, then you also have the possibility to set which page to use as a placeholder for the Blog page (which will use the home.php template):

    http://i.stack.imgur.com/G7tOM.png

    More technical details are available in the WordPress Codex.

Comments are closed.