How to determine the current widget’s parent container (sidebar widget id)

If your widgets use the widget API you should have the following method in your widget class…

function widget($args, $instance){
    //output html here...
}

$args['id'] will hold the id of the current sidebar.

Leave a Comment