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.

Add classes automatically when using the SiteOrigin editor

Open 2 replies customizationpluginplugin-page-builder
Started · Latest reply by Andrew Misplon

Hi,

I always add a class for the rows (so-row-obsnev) and the cells (so-cell-obsnev) of the editor.

Is there any way to add these classes by default?

Thanks in advance

This is our free support forum. Replies can take several days.

Need fast email support? Get SiteOrigin Premium

Replies

2
  1. Andrew Misplon Staff

    Hi Manolo

    Thanks for reaching out.

    We have examples of how to automatically add classes in our developer documentation. Unfortunately, it isn’t a normal usage task but a developer/programming level task. I don’t know that we have examples of first detecting whether a widget is present in a row before adding a class. I’ll find out and come back to you.

  2. Andrew Misplon Staff

    Hi Manolo

    We’ll add this to our developer documentation shortly. Below is what we’re able to offer:

    function myplugin_filter_widget_classes( $classes, $widget_class, $instance, $widget_info ) {
    	if ( $widget_class == 'SiteOrigin_Widget_Editor_Widget' ) {
    		$classes[] = 'custom-class';
    	}
    	return $classes;
    }
    add_filter( 'siteorigin_panels_widget_classes','myplugin_filter_widget_classes', 10, 4 );

    Change custom-class to the class name you want to add. That’ll automatically add your class to the so-panel div if an Editor widget is contained within. Not quite what you asked for but what we’re able to offer at the moment. I hope it helps in some way. Here is the result https://imgur.com/a/Ul5JEu3.

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