Simple way to do some Visual Composer Grid cleanup, when you are using Bootstrap within your theme. This removes and cleans up classes.
add_filter('vc_shortcodes_css_class', function ($class_string, $tag) { $tags_to_clean = [ 'vc_row', 'vc_column', 'vc_row_inner', 'vc_column_inner' ]; // replace vc_, but exclude any custom css // attached via vc_custom_XXX (negative lookahead) // replace all vc_ // $class_string = preg_replace('/vc_/i', '', $class_string); } return $class_string; }, 10, 2);
Visual Composer for WordPress
Bootstrap / Bootstrap Sass
BOOKING SOLUTIONS 202x This is my take on a subset of booking, appointment, PMS or… Read More
THE GOAL Create a system cron for WordPress, that is accessible and can be easily… Read More
2024, what's cooking? Slowly getting into the 2024 spirit. 3 projects coming to a close… Read More
Short look back at 2023 This has been a busy and interesting year. I am… Read More
Elementor Pro provides grid containers as an experimental feature. The options provided are limited, when… Read More
Archaeology Travel is an online travel guide for people who enjoy exploring the world’s pasts.… Read More
View Comments
When you replace "vc_" it removes the background image in a row. Not sure why.
Quick fix: add
$class_string = str_replace('custom_', 'vc_custom_', $class_string);
Alex
Or even better using a negative lookahead :)
$class_string = preg_replace('/vc_(?!custom)/i', '', $class_string);
Updated the above code accordingly.
Enjoy
Alex
Hey Alex, great job! So we can forget about the .container and container-fluid wrapper class from bootstrap or how do you handle that?
Hi,
it will behave just like a standard bootstrap theme. Some tweaks might be needed, depending on addons used or special use cases.
Alex