WordPress.org

Make WordPress Core

Opened 2 years ago

Last modified 3 months ago

#20287 new enhancement

Load header and footer template files using hooks

Reported by: johnbillion Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 1.5
Component: Themes Keywords: has-patch needs-refresh
Focuses: template Cc:

Description

The theme header and footer files are loaded from inside the get_header() and get_footer() functions.

If these files were instead loaded from helper functions that were hooked into actions inside get_header and get_footer then we'd get two nice benefits:

  1. Theme frameworks that call a function or fire an action immediately after the header would be able to use the hooks instead of placing the calls directly in each file. For example, Thematic calls thematic_abovecontainer() in each template file immediately after get_header(). It could instead add this via a hook.
  2. Fancy schmancy themes or plugins that add partial-page AJAX loading (using a system such as PJAX) could unhook the header and footer when they're unneeded in AJAX requests.

Patch coming up.

Attachments (1)

20287.patch (4.5 KB) - added by johnbillion 2 years ago.

Download all attachments as: .zip

Change History (5)

johnbillion2 years ago

comment:1 johnbillion2 years ago

  • Keywords has-patch added

Patch. I might not have explained the use cases above very well. If it needs clarifying please let me know.

comment:2 c3mdigital8 months ago

  • Keywords needs-refresh added
  • Version set to 1.5

Related #21506

comment:3 bungeshea4 months ago

  • Cc info@… added

comment:4 nacin3 months ago

  • Component changed from Template to Themes
  • Focuses template added
Note: See TracTickets for help on using tickets.