1. Home
  2. Docs
  3. Filters
  4. vc_shortcodes_css_class

vc_shortcodes_css_class

Example how you can alter class names that are outputted for built in content elements and elements that follow up our coding guidelines and utilize apply_filters( VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, …); filter in their html output.

<?php
add_filter('vc_shortcodes_css_class', 'change_element_class_name', 10, 2);
function change_element_class_name($class_string, $tag) {
   // modify $class_string variable to your needs. You can use $tag variable to determine what element is currently rendered.
   return $class_string;
}

Note: You can hook into vc_shortcodes_css_class filter only if this filter is applied in the contents element output. Like so:

<?php
//.. some code
$css_class = apply_filters( VC_SHORTCODE_CUSTOM_CSS_FILTER_TAG, $width_class, $this->settings['base'], $atts );
//.. some code
?>