WordPress.org

Make WordPress Core

Opened 3 years ago

Last modified 15 months ago

#36402 new enhancement

front-page.php behavior for child themes

Reported by: cristovaov Owned by:
Milestone: Awaiting Review Priority: normal
Severity: minor Version:
Component: Themes Keywords:
Focuses: template Cc:

Description

Currently, if a parent theme has a front-page.php template, child theme inherits this too.

I think this should not happen.

On this specific case, I think that a child theme should behave like a parent one.
The attached patch checks:

   if 
     * A child theme is NOT used
     or
       * A child theme is being used and includes 'front-page.php'
   then 
     * Load 'front-page.php'

This allows a child theme to include its own front-page.php template or setting the front-page to a page from the 'Reading' setting.

Attachments (1)

patch.diff (714 bytes) - added by cristovaov 3 years ago.
Patch function get_front_page_template()

Download all attachments as: .zip

Change History (3)

@cristovaov
3 years ago

Patch function get_front_page_template()

#1 @chriscct7
3 years ago

  • Version trunk deleted

#2 @joyously
15 months ago

  • Severity changed from normal to minor

I think that a child theme would expect to use the same templates as the parent unless the child theme did something about it. So the onus is on the child theme to add a filter for template_redirect if it does not want to use the parent template.

All the other child themes that expect to get the parent template will then still work.

Note: See TracTickets for help on using tickets.