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.
Need fast email support? Get SiteOrigin Premium
Replies
2Hi 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.
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-classto the class name you want to add. That’ll automatically add your class to theso-paneldiv 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.