Make WordPress Core

Opened 18 years ago

Closed 18 years ago

#4258 closed defect (bug) (fixed)

Widgets don't show up with new integrated widgets.php

Reported by: kretzschmar's profile kretzschmar Owned by:
Milestone: 2.2 Priority: high
Severity: normal Version: 2.2
Component: General Keywords: widgets, dynamic_sidebar
Focuses: Cc:

Description

Although all Widgets are shown nicely under presentaion tab, they don't show up in the blog if you register your sidebars using names instead of the default numbers.
If you use:

register_sidebar(array('name'=>'Sidebar-Column1'));

You can't use:

dynamic_sidebar('Sidebar-Top');

to show Widgets. Only by using numbered Sidebars (SIdebar1, Sidebar2 etc.) it works.
(btw I am using a german locale).

Change History (16)

#1 @kretzschmar
18 years ago

  • Priority changed from normal to high

#2 @technosailor
18 years ago

I can confirm that this is indeed a problem, even in the latest revision of 2.2 r5466. I tested on an existing widgetized 2.1.3 blog with a custom theme that has no id paramter, only a name parameter. The name paramter is respected in terms of name, but widget are not properly placed in the sidebars. In fact it's as if the widgetized sidebar did not exist. As an example, in this case, in %theme%/functions.php we use:

`if ( function_exists('register_sidebar') )

register_sidebar(array(

'before_widget' => '<div id="%1$s" class="widget wide %2$s">',
'after_widget' => '</div>',
'before_title' => '<h2 class="title">',
'after_title' => '</h2>',

'name' => 'Full width - top'

)
);`

and in the sidebar.php:

` <?php if ( !function_exists('dynamic_sidebar')

!dynamic_sidebar('Full width - top') ) : ?>`

#3 @technosailor
18 years ago

Ok, that formatting is screwed. Lets try again:

if ( function_exists('register_sidebar') )

    register_sidebar(array(

        'before_widget' => '<div id="%1$s" class="widget wide %2$s">', 'after_widget' => '</div>', 'before_title' => '<h2 class="title">', 'after_title' => '</h2>',

            'name' => 'Full width - top'

    ) );

and

<?php if ( !function_exists('dynamic_sidebar')
 !dynamic_sidebar('Full width - top') ) : ?>

#4 @ryan
18 years ago

The sidebar ID is being created differently, so the new code doesn't see the old sidebar. Working on a fix.

#5 @ryan
18 years ago

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

(In [5473]) Allow sidebar names to be passed to dynamic_sidebar(). fixes #4258 for 2.2

#6 @ryan
18 years ago

(In [5474]) Allow sidebar names to be passed to dynamic_sidebar(). fixes #4258 for 2.3

#7 @ryan
18 years ago

Does that help?

#8 @kretzschmar
18 years ago

Now it is fixed. Is this added to the final version of 2.2 now?

#9 @JeremyVisser
18 years ago

Yes, the fix will be in the final release of 2.2.

#11 @foolswisdom
18 years ago

  • Milestone set to 2.2

#12 @sunburntkamel
18 years ago

  • Milestone changed from 2.2 to 2.2.2
  • Resolution fixed deleted
  • Status changed from closed to reopened

this is still not working for me, using SVN. i've got another user running into the problem with the release version of 2.2

my environment: http://archgfx.net/phpinfo.php

widget call in my theme:
http://disconnected.svn.sourceforge.net/viewvc/disconnected/Trunk/functions.php?revision=50&view=markup#l_129

#13 @sunburntkamel
18 years ago

  • Resolution set to worksforme
  • Status changed from reopened to closed

looks like i need to add an

'id' => '1'

and

'id' => '2'

to make them both work?

#14 @rob1n
18 years ago

  • Milestone changed from 2.2.2 to 2.2

#15 @Nazgul
18 years ago

  • Resolution worksforme deleted
  • Status changed from closed to reopened

#16 @Nazgul
18 years ago

  • Resolution set to fixed
  • Status changed from reopened to closed
Note: See TracTickets for help on using tickets.