Make WordPress Core

Opened 12 years ago

Closed 9 years ago

#20287 closed enhancement (wontfix)

Load header and footer template files using hooks

Reported by: johnbillion's profile johnbillion Owned by:
Milestone: Priority: normal
Severity: normal Version: 1.5
Component: Themes Keywords: has-patch
Focuses: template Cc:


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 (2)

20287.patch (4.5 KB) - added by johnbillion 12 years ago.
20287.1.diff (2.4 KB) - added by MikeHansenMe 9 years ago.

Download all attachments as: .zip

Change History (9)

12 years ago

#1 @johnbillion
12 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.

#2 @c3mdigital
11 years ago

  • Keywords needs-refresh added
  • Version set to 1.5

Related #21506

#3 @bungeshea
10 years ago

  • Cc info@… added

#4 @nacin
10 years ago

  • Component changed from Template to Themes
  • Focuses template added

9 years ago


#5 @MikeHansenMe
9 years ago

  • Keywords needs-refresh removed

#6 @obenland
9 years ago

20287.1.diff looks incomplete, @MikeHansenMe.

@johnbillion: Should the get_(header|footer) action be moved inside the load functions? They're currently being used in a context where template loading happens immediately afterwards. I'd also suspect that in most cases where you wouldn't want header of footer to be loaded, you wouldn't want these actions to fire either.

#7 @johnbillion
9 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to wontfix
  • Status changed from new to closed

No real traction in 4 years, and most PJAX-like libraries just strip out the header and footer anyway.

Note: See TracTickets for help on using tickets.