Get the $instance variable inside the widget __construct function

i am tring grab the $instance varible inside the __construct function of a widget.
i need this so i can create a dynamic widget name

I tried:

printing out the $instance
Printing out $this

Here is an example __construct function i am using in one of my widgets

// DEFINE THE WIDGET
function __construct() {

$widget_ops = array(
‘classname’ => ‘sg_image_widg’,
‘description’ => __(‘Custom Image widget by SITEIT’, ‘siteitsob’)
);

parent::__construct(‘sgImageWidget’, __(‘Image Widget’, ‘siteitsob’), $widget_ops);

add_action(‘admin_enqueue_scripts’, array($this, ‘upload_scripts’));
}

Ideas anyone?

Read more here:: Get the $instance variable inside the widget __construct function

Leave a Reply

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