Last active
October 13, 2015 22:12
-
-
Save facelordgists/1b0b602432175937f658 to your computer and use it in GitHub Desktop.
Remap Visual Composer 4.3.x and newer CSS column class names back to legacy class names
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /* | |
| Plugin Name: Visual Composer Legacy Class Remapper | |
| Description: Remap Visual Composer (4.3.x and newer) CSS column & row class names back to legacy (4.2.x and older) class names | |
| Version: 1.0.0 | |
| Author: Milo Jennings | |
| License: GPL2 | |
| Plugin URI: https://gist.github.com/1b0b602432175937f658 | |
| */ | |
| // Filter to replace default css class names for vc_row shortcode and vc_column | |
| 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_span$1', $class_string ); // This will replace "vc_col-sm-%" with "vc_span%" | |
| } | |
| $class_string = str_replace( 'vc_column_container', 'column_container', $class_string ); // This will replace "vc_column_container" with "column_container" | |
| 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