Make WordPress Core

Opened 9 years ago

Last modified 4 months ago

#36402 new enhancement

front-page.php behavior for child themes

Reported by: cristovaov's profile cristovaov Owned by:
Milestone: Awaiting Review Priority: normal
Severity: minor Version:
Component: Themes Keywords: close
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 9 years ago.
Patch function get_front_page_template()

Download all attachments as: .zip

Change History (4)

@cristovaov
9 years ago

Patch function get_front_page_template()

#1 @chriscct7
9 years ago

  • Version trunk deleted

#2 @joyously
7 years 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.

#3 @poena
4 months ago

  • Keywords close added

If the parent theme includes front-page.php, then the child theme uses this template unless the child theme includes it's own front-page.php file.

I don't think that the front-page.php template should be handled in a different way from other template files and I think changing how this template works would be a breaking change and cause for confusion.

The front-page.php is used to display the static page or the blog, so this suggestion that was mentioned is already possible:

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.

Because of this I recommend closing this ticket.

Note: See TracTickets for help on using tickets.