To override directory where WPBakery Page Builder should look for template files for content elements call vc_set_shortcodes_templates_dir() function from your functions.php file. By default WPBakery Page Builder is looking for template files in this order:
- js_composer/include/templates/shortcodes/%shortcode_base%.php
- %active wp theme%/vc_templates/%shortcode_base%.php
- If it fails to find template file you will see a PHP notice. “Notice: Template file is missing for `%shortcode_base%` shortcode. Make sure you have `wp-content/themes/your_theme/vc_templates/%shortcode_base%.php` file in your theme folder
<?php vc_set_shortcodes_templates_dir( $dir ); ?>
Params
Param name
|
Type
|
Description
|
---|---|---|
$dir | String | New template directory path where WPBakery Page Builder should look for template files |
Example
How to change default template directory where WPBakery Page Builder looks for content elements template files.
<?php $dir = get_stylesheet_directory() . '/vc_new_templates_dir'; vc_set_shortcodes_templates_dir( $dir ); ?>
Note: You as a developer should decide what function to use in your theme get_stylesheet_directory() or get_template_directory()