WordPress.org

Make WordPress Core

Opened 7 years ago

Closed 7 years ago

#4258 closed defect (bug) (fixed)

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

Reported by: 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)

comment:1 kretzschmar7 years ago

  • Priority changed from normal to high

comment:2 technosailor7 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') ) : ?>`

comment:3 technosailor7 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') ) : ?>

comment:4 ryan7 years ago

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

comment:5 ryan7 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

comment:6 ryan7 years ago

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

comment:7 ryan7 years ago

Does that help?

comment:8 kretzschmar7 years ago

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

comment:9 JeremyVisser7 years ago

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

comment:10 technosailor7 years ago

Perfect!

comment:11 foolswisdom7 years ago

  • Milestone set to 2.2

comment:12 sunburntkamel7 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

comment:13 sunburntkamel7 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?

comment:14 rob1n7 years ago

  • Milestone changed from 2.2.2 to 2.2

comment:15 Nazgul7 years ago

  • Resolution worksforme deleted
  • Status changed from closed to reopened

comment:16 Nazgul7 years ago

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