Make WordPress Core

Opened 8 years ago

Last modified 7 years ago

#39773 new defect (bug)

Users Can Wrongly Set a Custom Page Template when front-page.php is in Use

Reported by: davidakennedy's profile davidakennedy Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version:
Component: Themes Keywords:
Focuses: Cc:

Description

If you try to set a custom page template in a theme that uses a front-page.php, front-page.php always wins. This is expected, but a user doesn't know that. They're still able to save the page, and it looks like it should work, but on the front end, front-page.php wins, and they may be left confused.

Discovered while researching #39299.

Steps to reproduce:

  1. Activate Twenty Seventeen.
  2. Set the front page to a static page.
  3. Create a page template.
  4. Assign it to the static page being used as the front page.
  5. Save.
  6. Visit front end – the template isn't used.

What I expected?

At the very least – WordPress doesn't save this change, and provides an error message. Better: The page template selection box doesn't show up in this case because setting a template when the front page is a static page and a theme has front-page.php isn't possible.

Attachments (1)

Screen Shot 2017-02-02 at 6.48.28 PM.png (186.5 KB) - added by davidakennedy 8 years ago.
Shows static page with template in use in theme with front-page.php

Download all attachments as: .zip

Change History (3)

@davidakennedy
8 years ago

Shows static page with template in use in theme with front-page.php

#1 follow-up: @swissspidy
8 years ago

  • Version trunk deleted

The page template selection box doesn't show up in this case because setting a template when the front page is a static page and a theme has front-page.php isn't possible.

What if the page template was previously set, i.e. before the page was chosen as the static front page.

While we're at it: what about the posts page?

#2 in reply to: ↑ 1 @johnbillion
7 years ago

Replying to swissspidy:

While we're at it: what about the posts page?

It's not possible to set a page template for the posts page.

Note: See TracTickets for help on using tickets.