Home>Support>Extending or altering the classes added to widgets

Extending or altering the classes added to widgets

Notice: This thread is over two years old; the information may be outdated. Please consider creating a new thread if you require free support. If you have an active SiteOrigin Premium license, you can email our premium support desk at [email protected].

Hi there,

My team has a number of custom widget’s we’ve created, the styling for which is all dependent upon a particular css class being applied to the widget.

Widgets from SO Page Builder are generated like this:

<div class="so-panel widget widget_uc_events_calendar_widget panel-first-child panel-last-child" id="panel-2043-1-1-0">

“widget_uc_events_calendar_widget” is referencing our custom plugin, but all of my css is looking for the selector .uc-ecw

It would be awesome if I could get a new class inserted in all of those, as that would save me from either doing a lot of work to my Sass files, or hacking it in with javascript.

Is there a filter, action, hook that I can tie into to change the

This is our free support forum. Replies can take several days. If you need fast email support, please purchase a SiteOrigin Premium license.

  1. 10 years, 1 month ago Andrew Bacon

    (looks like I hit submit a bit early… )

    Is there a filter, action, hook that I can tie into to change the classes?

  2. 10 years, 1 month ago Andrew Bacon

    Followup… we believe we figured out what’s going on.

    When attempting to use the page builder with a widget we created it does not add the proper class name to the widget wrapper. The widget was created similar to below and the ‘classname’ widget option does not get added to the widget wrapper. Instead it uses the default class which in this case would be widget_my_widget_id.

    class My_Widget extends WP_Widget {
        public function __construct() {
            $widget_options = array(
                'description'=> 'This is a widget.',
                'classname' => 'my-widget'
            );
            $widget_controls = array(
                'height' => 800, 
                'width' => 600
            );
            parent::__construct('my_widget_id', 'Widget Name', $widget_options, $widget_controls);
Replies on this thread are closed. Please create a new thread if you have a question, or purchase a SiteOrigin Premium license if you need one-on-one email support.

Get The Most Out of SiteOrigin with SiteOrigin Premium

Find Out More