Opened 21 months ago

Last modified 21 months ago

#18480 new enhancement

get_sidebar should be able to accept an array of names as parameter.

Reported by: gxxaxx Owned by:
Priority: normal Milestone: Awaiting Review
Component: Template Version: 3.2.1
Severity: normal Keywords: has-patch 2nd-opinion
Cc:

Description

get_sidebar uses load_template to do the work of template loading.
load_template will accept an array of template names for loading.
load_template will then load the first existing template from that array.

Seems like get_sidebar should also accept an array of names that can be searched in declining order.

This would allow a theme to specify a first choice, second choice, etc. for the sidebar.

Attachments (2)

general-template.php (77.0 KB) - added by gxxaxx 21 months ago.
Patch to general-template.php modify get_sidebar to accept array as parameter
general-template.patch (1.5 KB) - added by gxxaxx 21 months ago.
proper patch version of the file.

Download all attachments as: .zip

Change History (5)

Patch to general-template.php modify get_sidebar to accept array as parameter

  • Keywords has-patch get_sidebar theme added
  • Keywords 2nd-opinion added; get_sidebar theme removed

The fact that load_template() accepts an array is not a good reason for changing get_sidebar().

Related: #18331

PS: http://core.trac.wordpress.org/wiki#HowtoSubmitPatches

I totally agree that just because load_template() accepts an array is not sufficient justification.

In a theme I am developing I ran ran into a situation where I needed the functionality.

I'm definitely not trolling the codex looking for things to change. This came about as one possible answer for a theme situation.

But, I see that other -- wider sweeping -- changes are afoot in #18331. Thanks for the info.

PS: I was using http://funcdoc.wordpress.com/2008/01/21/how-to-patch-the-wordpress-core/
I appreciate your more up-to-date link.

proper patch version of the file.

Note: See TracTickets for help on using tickets.