vc_shortcode_content_filter

⌘K
  1. Home
  2. Docs
  3. Filters
  4. vc_shortcode_content_filter

vc_shortcode_content_filter

Filter the output of elements before it is rendered in the shortcode template.

add_filter('vc_shortcode_content_filter', 'wpb_add_wrapper_to_shortcode_output', 10, 3);
/**
 * Add a wrapper to the output of the vc_separator shortcode.
 *
 * @param string $output The output of the shortcode.
 * @param array $prepared_atts The prepared attributes for the shortcode.
 * @param string $shortcode_tag The shortcode tag.
 * @return string Modified output with a wrapper.
 */
function wpb_add_wrapper_to_shortcode_output( $output, $shortcode_tag, $prepared_atts ) {
    if ( isset( $prepared_atts['width'] ) ) {
        $output .= '<div class="custom-wrap">' . $output . '</div>';
    }
    return $output;
}
Was this article helpful to you? No Yes

How can we help?