WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

#34842 closed enhancement (wontfix)

Simplify get_home_template() template candidates

Reported by: Rahe Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Themes Keywords:
Focuses: template Cc:
PR Number:

Description

Hi,

I was wondering if this is mandatory that in the get_home_template function we have to specify home.php AND index.php as fallback as soon as we have the fallback on index.php at the end of template-loader.php ?

Attachments (1)

34842.diff (456 bytes) - added by Rahe 4 years ago.
first patch

Download all attachments as: .zip

Change History (8)

#1 @Rahe
4 years ago

  • Focuses template added

#2 @swissspidy
4 years ago

  • Summary changed from Update get_home_template to Simplify get_home_template() template candidates
  • Type changed from feature request to enhancement

Apart from saving some if/else checks in template-loader.php, I don't see a reason why get_home_template() must specify index.php as a template as well. I guess it makes the whole template hierarchy more clear.

See also #14310

@Rahe
4 years ago

first patch

#3 @Rahe
4 years ago

Oh ok, here is my patch :)

This ticket was mentioned in Slack in #core by swissspidy. View the logs.


4 years ago

#5 @mdawaffe
4 years ago

This patch changes the behavior of get_home_template() in the case where the theme has a paged.php and an index.php but no home.php.

The current behavior is to use index.php for both / and /page/2/.

With the patch, the behavior changes to using index.php for / but paged.php for /page/2/.

#6 @Rahe
4 years ago

Oh yes I've missed this case :/.
I think it's better to leave this alone for not breaking the backcompat and template hierarchy.

#7 @obenland
4 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to wontfix
  • Status changed from new to closed
  • Version 4.4 deleted
Note: See TracTickets for help on using tickets.