[theme-reviewers] WP_DEBUG notices with the_widget()
sayontan at gmail.com
Wed Feb 22 20:22:50 UTC 2012
I did notice this problem with your theme earlier, and IIRC it can be
replicated even in a dynamic sidebar. Here is how I could replicate it:
1. Assume I am running version x of your theme. I have some widgets that
I have added to the sidebar.
2. I then switch to another theme. Obviously your widgets don't exist
there, so I add this new theme's widgets.
3. Now, you release version x+1 of your theme. When I activate it, I see
the old Hybrid widgets I had added in the "Inactive Widgets" area.
4. So I drag those widgets from my "Inactive Widgets" to the sidebars.
This means I don't have to save anything on the sidebar: not even the old
widgets. Following this if I refresh the front-end I get a bunch of notices.
I haven't tried this recently, so I am not sure if the problem can be
replicated in this manner.
On Wed, Feb 22, 2012 at 12:07 PM, Justin Tadlock
<justin at justintadlock.com>wrote:
> One thing I recently noticed with my themes that have widgets is that I
> get some undefined index/variable notices when using the_widget() function
> to output a widget created by my theme. This wouldn't show up unless
> someone actually used the_widget() function. Using it as a regular widget
> in a dynamic sidebar is fine because the variables always get set on widget
> This issue arises when you're building a widget with options. Typically,
> you'd grab these options from the $instance parameter for the widget()
> method. When calling the_widget( 'My_Widget_Class' ); in my theme,
> WP_DEBUG goes crazy. The problem is simply that there's no checks if
> $instance['some_option'] has been set.
> I'm going through all my widgets right now to update them for this use
> case. I don't think it's overly important because it's a pretty rare
> scenario and definitely one you wouldn't notice in a typical review, but I
> thought I'd post it here for you all.
> theme-reviewers mailing list
> theme-reviewers at lists.wordpress.org
http://mynethome.net | http://mynethome.net/blog
Beating Australia in Cricket is like killing a celebrity. The death gets
more coverage than the crime.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the theme-reviewers