Skip to content

Instantly share code, notes, and snippets.

@kosmiq
Created August 18, 2016 09:55
Show Gist options
  • Save kosmiq/75ed32f9ba9c63b684adcb850e998fa1 to your computer and use it in GitHub Desktop.
Save kosmiq/75ed32f9ba9c63b684adcb850e998fa1 to your computer and use it in GitHub Desktop.
Visual Composer default to md columns instead of sm columns
/**
* An ugly hack to change Visual Composer default columns output to md instead of sm. Changes ALL of them so be careful.
* Still a better way than using the custom design options in Visual Composer that outputs a large, un-minified, custom-styles even if you only change the mobile breakpoint.
*/
add_filter( 'vc_shortcodes_css_class', 'custom_css_classes_for_vc_row_and_vc_column', 10, 2 );
function custom_css_classes_for_vc_row_and_vc_column( $class_string, $tag ) {
if ( $tag == 'vc_column' || $tag == 'vc_column_inner' ) {
$class_string = preg_replace( '/vc_col-sm-(\d{1,2})/', 'vc_col-md-$1', $class_string ); // This will replace "vc_col-sm-%" with "vc_col-md-%"
}
return $class_string; // Important: you should always return modified or original $class_string
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment