Make WordPress Core

Opened 19 years ago

Closed 19 years ago

#4258 closed defect (bug) (fixed)

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

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

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
19 years ago

  • Priority normalhigh

#2 @technosailor
19 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
19 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
19 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
19 years ago

  • Resolutionfixed
  • Status newclosed

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

#6 @ryan
19 years ago

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

#7 @ryan
19 years ago

Does that help?

#8 @kretzschmar
19 years ago

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

#9 @JeremyVisser
19 years ago

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

#11 @foolswisdom
19 years ago

  • Milestone2.2

#12 @sunburntkamel
19 years ago

  • Milestone 2.22.2.2
  • Resolution fixed
  • Status closedreopened

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
19 years ago

  • Resolutionworksforme
  • Status reopenedclosed

looks like i need to add an

'id' => '1'

and

'id' => '2'

to make them both work?

#14 @rob1n
19 years ago

  • Milestone 2.2.22.2

#15 @Nazgul
19 years ago

  • Resolution worksforme
  • Status closedreopened

#16 @Nazgul
19 years ago

  • Resolutionfixed
  • Status reopenedclosed
Note: See TracTickets for help on using tickets.