This thread is over two years old and may be outdated. Please create a new thread if you need help, or email us if you have an active Premium license.

Extending or altering the classes added to widgets

10 years ago · Last reply by Andrew Bacon 10 years ago

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.

Need fast email support? Get SiteOrigin Premium

Replies

2
  1. Andrew Bacon 10 years, 8 months ago

    (looks like I hit submit a bit early… )

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

  2. Andrew Bacon 10 years, 8 months ago

    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.

Have a different question or issue?

Start New Thread