Skip to content

Snippet: Insert Content Before or After any Element

Below are 2 very basic sample functions showing you how you could insert content before or after Total builder modules/shortcodes. Note that the action does pass on both the $shortcode and $atts variables. The $shortcode variable is the name of the module and the $atts variable is an array of defined shortcode parameters.

// Add content before a module
add_action( 'vcex_shortcode_before', function( $shortcode, $atts ) {
	echo 'custom before module content';
}, 10, 2 );

// Add content after a module
add_action( 'vcex_shortcode_after', function( $shortcode, $atts ) {
	echo 'custom after module content';
}, 10, 2 );
All PHP snippets should be added via child theme's functions.php file or via a plugin. We recommend Code Snippets (100% Free) or WPCode (sponsored)
Back To Top