Home>Support>Add classes automatically when using the SiteOrigin editor

Add classes automatically when using the SiteOrigin editor

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. If you need fast email support, please purchase a SiteOrigin Premium license.

  1. 4 years, 11 months ago Andrew Misplon
    Hi, I Work Here

    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. 4 years, 10 months ago Andrew Misplon
    Hi, I Work Here

    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.

Get The Most Out of SiteOrigin with SiteOrigin Premium

Find Out More