I have multiple “sidebars”, but not all of them are the same size. Not all widgets fit in all sidebars (for example, I have a “footer sidebar” where the client can place custom widgets, but they are wide, and don’t fit at all in the “real” sidebar). I want to give an indication when a widget is placed in a sidebar where it would not belong (change the header text color, for example). What would be the best way to do this?

3 s
3

There is a widget_display_callback hook, which you can use to override the widget based on the sidebar and the widget (return false when inappropriate):

http://core.trac.wordpress.org/browser/trunk/wp-includes/widgets.php?rev=15590#L180

Leave a Reply

Your email address will not be published. Required fields are marked *