WordPress.org

Make WordPress Core

Opened 7 years ago

Closed 6 years ago

#28045 closed feature request (duplicate)

Passing variables to header

Reported by: gallantfish Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.8.3
Component: Themes Keywords:
Focuses: template Cc:

Description

I'd like to pass variables to get_header() so I don't have to add extra formatting to get the header to behave / look different when the only change is the template.
I don't want to create a new header just to add a class, nor detecting the template just to add a mobile version of the menu to the header.

The cleanest way to do it, when only ONE thing triggers everything (a different template is selected) is by get_header() accepting variables.

I have presented in previous feature requests future scenarios which became true in the next two years (as wp enhancements or successful plugins), and I was attacked, so excuse me if I don't present many cases now, in which this request would save us lots of time.

I just don't remember them all the scenarios to open your mind to the possibilities without you having your own brainstorming, but I see previous people asking for this and they were just suggested alternate solutions (i.e. adding extra code and steps to accomplish the single usage they proposed).

Thanks.

Change History (2)

#1 @SergeyBiryukov
7 years ago

  • Focuses template added

Related: #21676

#2 @wonderboymusic
6 years ago

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

Duplicate of #21676.

We aren't going to alter the existing funcs to take $data, but it's possible that a new API could be created that takes a template and data. The main issue here: all templating languages take a template or template name AND data. We are in a weird spot, because we use raw PHP for templating.

Note: See TracTickets for help on using tickets.