I have a static homepage with a custom template I.E hompage.php the blog loop is set to a static page named blogg, it uses the index.php page as a template, there a collection of other pages using the index.php as the default template so i am reluctant to change it. is there anyway to stop the blogg page from using index.php and give the blog page it’s own template page such as blogg-template.php?
kind regards
Chris
Leave a Reply
You must be logged in to post a comment.
Please consult the Template Hierarchy, and ensure that you are using the correct names for template files.
index.php
should be left as the default fallback for all other template filesfront-page.php
. You need to rename yourhomepage.php
asfront-page.php
home.php
. WordPress will always and only ever use eitherhome.php
orindex.php
for the blog posts index (unless the blog posts index is set to display on the site front page, andfront-page.php
exists). No other template files will be used, regardless of what you name them, or whether or not you assign them as custom page templates to the page used to render the blog posts index.Step-by-step:
front-page.php
as your custom front-page templatehome.php
as your blog posts index page templateindex.php
aloneDashboard -> Settings -> Reading
You need to refer to the Template Hierarchy to understand what you need to do. Specifically, you need the “Home Page Template” section.
To modify the blog page (aka “Page for Posts) (which is the “home” page, even if it’s not set as your “front page”), you should use the
home.php
template. The blog will automatically use it.index.php
is only used for your blog ifhome.php
is not present in your theme’s folder.If you try to select a Custom Page Template on the page set to the “Page For Posts” setting on Settings > Reading, it will be ignored. You have to use
home.php
.