stop blog page from using index.php?

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

2 Answers
2

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 files
  • The site front page template file name is front-page.php. You need to rename your homepage.php as front-page.php
  • The blog posts index page template file name is home.php. WordPress will always and only ever use either home.php or index.php for the blog posts index (unless the blog posts index is set to display on the site front page, and front-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:

  1. Create front-page.php as your custom front-page template
  2. Create home.php as your blog posts index page template
  3. Leave index.php alone
  4. Create two static pages, of any name; e.g. “Front Page” and “Blog”
  5. Go to Dashboard -> Settings -> Reading
  6. Set Front Page Displays to a static page
  7. Set Front page dropdown to “Front Page” static page created in step 4
  8. Set Posts page dropdown to “Blog” static page created in step 4

Leave a Comment