Make WordPress Core

Opened 9 years ago

Closed 9 years ago

Last modified 9 years ago

#8511 closed defect (bug) (invalid)

Mixing up sidebars

Reported by: dcole07 Owned by:
Milestone: Priority: normal
Severity: major Version: 2.7
Component: Widgets Keywords:
Focuses: Cc:


I have a theme with multiple sidebars. I registered these sidebars within different files, then had the theme's function.php include them. The problem comes when using the Widgets page in the dashboard. When I assign widgets to "Left Sidebar" and "Right Sidebar", then view the site, as a visitor, the widgets are in the opposite sidebar. So the Widgets page says "Left Sidebar", but means "Right Sidebar" and vise versa.

The "Right Sidebar" has the value "sidebar-1" and is registered before the "Left Sidebar", which has the value "sidebar-2". But when they are displayed to visitors, the "Left Sidebar" is included in the code before the "Right Sidebar".

Do sidebars actually use the name given to them when using get_sidebar(); ? I guess this could be a slip-up on my part, but I've checked and I don't see anything wrong.

Change History (5)

#1 @markjaquith
9 years ago

  • Milestone changed from 2.7 to 2.8

#2 @dcole07
9 years ago

The description above is wrong. I've looked into it further. The problem is that get_sidebar() does not call the dynamic_sidebar() without the theme developer telling it to do so.

I think get_sidebar() should make an attempt to get dynamic_sidebar if it fails to find the sidebar-{$name}.php file, but before it defaults to a a generic sidebar.

#3 @ryan
9 years ago

  • Component changed from Themes to Widgets

#4 @Denis-de-Bernardy
9 years ago

  • Resolution set to invalid
  • Status changed from new to closed

seems to be working fine, as long as you don't get mixed up in sidebar names. you'd use sidebar(2) to get sidebar-2.php.

#5 @Denis-de-Bernardy
9 years ago

  • Milestone 2.8 deleted
Note: See TracTickets for help on using tickets.