LESS file filter

This filter gives you a way to change the LESS file that's being used to create your widget style. We use this filter in our section on extending existing widgets. This guide will give you the best idea of what this filter is for and how you'll likely be using it.

This filter has the form 'siteorigin_widgets_less_file_' . $this->id_base, where id_base is the ID of the widget.

function mytheme_button_less_file( $filename, $instance, $widget ){
    if( !empty($instance['design']['theme']) && $instance['design']['theme'] == 'test' ) {
        $filename = plugin_dir_path( __FILE__ ) . 'less/test.less';

        // And this one for themes
        $filename = get_stylesheet_directory() . '/less/test.less'; 
    }
    return $filename;
}
add_filter( 'siteorigin_widgets_less_file_sow-button', 'mytheme_button_less_file', 10, 3 );