Make WordPress Core

Opened 4 years ago

Last modified 4 years ago

#51658 assigned enhancement

Themes: Allow template loading functions to filter templates to search for

Reported by: amibe's profile amibe Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 3.0
Component: Themes Keywords: has-patch
Focuses: template Cc:

Description

Allow template loading functions to filter templates to search for.

This affects:

  • get_header()
  • get_footer()
  • get_sidebar()
  • get_template_part()

Note: there's an added check such that if the templates value returned is empty() the function returns false.

Change History (4)

This ticket was mentioned in PR #670 on WordPress/wordpress-develop by AmibeWebsites.


4 years ago
#1

  • Keywords has-patch added

Allow template loading functions to filter templates to search for.

This affects:

  • get_header()
  • get_footer()
  • get_sidebar()
  • get_template_part()

Note: there's an added check such that if the templates value returned is empty() the function returns false.

Trac ticket: https://core.trac.wordpress.org/ticket/51658

#2 @SergeyBiryukov
4 years ago

Hi there, welcome to WordPress Trac! Thanks for the ticket.

Just noting that this is related to #13239, which was extensively discussed and should also resolve this.

#3 @amibe
4 years ago

Thank you. Admittedly I'm more interested in being able to prevent the header, footer and sidebar templates from being included in certain situations.

The only way I could think of doing this is a filter for $templates that returns false.

The PR I've submitted is unrelated to changing the path/location of template files.

#4 @hellofromTonya
4 years ago

  • Version changed from trunk to 3.0

This ticket is not directly caused by 5.6 (trunk). As Sergey notes, it's related to #13239, which is Version 3.0. Updating the version to match.

Note: See TracTickets for help on using tickets.