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.
1 comment
Comments are closed.
In short:
index.php
is a fallback template only, in case no appropriate template was foundhome.php
is used for the blog (a listing of recent posts)front-page.php
is used for the landing-pageThe universal
index.php
templateThe
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 afront-page.php
nor ahome.php
thenindex.php
will be used. This is also true for missingarchive.php
orsingle.php
and so on.Regarding
front-page.php
VShome.php
Now the difference between
front-page.php
andhome.php
templates is that thefront-page.php
is used, as its name suggests, as the main front-page of the site, whilehome.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, thenhome.php
will be used instead. If both thefront-page.php
andhome.php
template files are missing then theindex.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 thehome.php
template. Ifhome.php
doesn’t exist then theindex.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):More technical details are available in the WordPress Codex.