Snippets: Insert Template Content via Theme Hooks

The following snippet shows you how you can insert a WPBakery template to your site via a hook, this is ideal for advanced usage where you may need to add custom conditionals so it doesn't show up on every page, however, if you are adding the template on every page you may want to instead use the theme's Custom Actions panel.

// Insert Templatera content after the header via the wpex_hook_header_after hook
add_action( 'wpex_hook_header_after', function() {

	// Change this to the templatera post ID you want to grab content from
	$template = 100;

	// Get Design options CSS for the template (fixes bug with wpbakery not rendering design options on archives)
	if ( function_exists( 'vcex_wpb_shortcodes_custom_css' ) ) {
		echo vcex_wpb_shortcodes_custom_css( $template );

	// Display template
	echo do_shortcode( '[templatera id="' . $template . '"]' );

} );
All PHP snippets should be added via a child theme's functions.php file or via the Code Snippets Plugin (or alternative plugin)