[wp-trac] [WordPress Trac] #4316: Widgets with multiple instances
(like RSS or Text) not receiving $number
WordPress Trac
wp-trac at lists.automattic.com
Tue May 22 16:40:42 GMT 2007
#4316: Widgets with multiple instances (like RSS or Text) not receiving $number
------------------------+---------------------------------------------------
Reporter: adamrbrown | Owner: anonymous
Type: defect | Status: new
Priority: normal | Milestone:
Component: General | Version: 2.2
Severity: normal | Keywords: widget
------------------------+---------------------------------------------------
In v2.2, the new widgets infrastructure does not appropriately pass a
$number argument to widgets that have multiple instances (i.e. widgets
like the RSS and Text widgets, which have more than one instance--but this
defect does NOT apply to the RSS and Text widgets themselves, since they
were updated with 2.2).
Example: I have two widgets in the plugins repository. Neither is
receiving a $number parameter. These are the only arguments being passed:
{{{
[name] => Sidebar 1
[id] => sidebar-1
[before_widget] => <li id="kb-advanced-rss-2" class="widget 2">
[after_widget] => </li>
[before_title] => <h2 class="widgettitle">
[after_title] => </h2>
}}}
There also needs to be
{{{
[number] => 1
}}}
Otherwise instances after the first of this widget look exactly like the
first instance.
My two widgets are among several in the wordpress.org plugins repository
that are modeled after the previous RSS and Text widgets, using the exact
same method to allow users to have multiple instances. Thus, this defect
has probably broken many, many plugins.
I've patched my plugins with a messy workaround that extracts the number
from the class in "before_widget." But fixing this defect is necessary for
backwards compatibility, i.e. so the same widget can be used in older and
new versions of WP.
--
Ticket URL: <http://trac.wordpress.org/ticket/4316>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list