Opened 15 years ago
Closed 15 years ago
#11883 closed defect (bug) (invalid)
Issue with multiple sidebars
Reported by: | camiloclc | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | General | Keywords: | load_template, sidebar, sidebars |
Focuses: | Cc: |
Description
I'm trying to add dynamically created sidebars to a theme I'm developing, so I can't know how some of these sidebars will be called. I also have sidebars which I can identify normally, but I don't want to create several sidebar-(x).php which would all be very simple and identical (they'd only call dynamic_sidebar(x)). Actually, in most themes I create I end up using the same code for several sidebars.
I'm facing two issues here:
1 - I can't get the current sidebar name in the default sidebar.php template file
I worked around this by setting a global variable which is assigned the current sidebar name when the get_sidebar action is fired. Then I call dynamic_sidebar with this variable as the parameter.
2 - load_template() doesn't load a template twice
Either load_template calls require instead of require_once or get_sidebar() gets a change like the one that was done with get_search_form() in ticket 9908 , where the require was moved inside the get_search_form() function.
Like the search form template, the sidebar template is one which may be called multiple times. Maybe the 2nd option would be a better fit.
Try asking for help on the wp-hackers mailing list first.
Reopen the ticket when you have a concrete proposal, or create a ticket that points to a clear problem.