WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#12593 closed defect (bug) (invalid)

Wrong template is loaded when using static home page

Reported by: alekseykorzun Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Template Keywords:
Focuses: Cc:

Description

Observed following bug when using static page as a home page (configured in 'reading' part of settings).

  1. Create a new page named 'Home', with template 'Home' (home.php).
  2. Create a new page named 'Blog', with template 'Blog' (blog.php).
  3. Set 'Home' as your static home page and set 'Blog' as your posts page.

When accessing Blog, instead of blog.php you are presented with a home.php template; because templating system overrides it when home.php is present in a theme directory.

It should not override it and display properly configured template instead.

This could be manually resolved by renaming 'Home' page and template to 'Main',etc.

Thank you.

Change History (3)

comment:1 greenshady4 years ago

home.php is supposed to always be used (if present) for the posts page. However, I would be a fan of renaming home.php since it doesn't accurately represent the posts page anymore. I'm fairly certain the way this is handled is a deliberate development choice and is not a bug with the system.

I'm suggesting "wontfix", but I wouldn't be entirely against changing it.

comment:2 filosofo4 years ago

  • Milestone Unassigned deleted
  • Resolution set to invalid
  • Status changed from new to closed

As greenshady says, home.php is a reserved name for templates.

comment:3 dd324 years ago

home.php is a reserved name for templates.

Just touching on that, I'd always advise people to name template files such that they're easy to find, such as "template-home.php"

Note: See TracTickets for help on using tickets.