There are two areas in my theme for widgets. But what should I do if I want to define two different templates to the same widget? a template to the widget when it’s in X area and other template to the same widget when it’s in Y area.
The format of the widget is normal:
class some_widget extends WP_Widget {
function some_widget() { .. }
function widget() { .. }
function update() { .. }
function form() { .. }
}
widget() includes the template of the widget.
Thank you.
In the first parameter of widget function, you will find the sidebar id and name, for example :
To get the name of the sidebar instead of id, just use
$args['name']But before trying this, did you try with different css rules ?