vc_shortcodes_theme_templates_dir()

⌘K
  1. Home
  2. Docs
  3. Inner API
  4. vc_shortcodes_theme_templates_dir()

vc_shortcodes_theme_templates_dir()

This function returns path to the folder where WPBakery Page Builder is looking for content element templates. By default it returns empty string, but if vc_set_shortcodes_templates_dir() was used previously, then custom directory path will be returned.

<?php vc_shortcodes_theme_templates_dir( $template ); ?>

Params

Param name
Type
Description
$templateStringContent element template file name. For [my_shortcode] shortcode template file is my_shortcode.php. For default “Message box” element, template file name is vc_message.php

Example

Get current custom templates directory path.

<?php
$dir = get_stylesheet_directory() . '/vc_new_templates_dir'; // First, set new directory for templates
vc_set_shortcodes_templates_dir( $dir );
// ...
var_dump( vc_shortcodes_theme_templates_dir( 'vc_message.php' ) ); // Outputs full directory path for vc_message.php template
?>

 

Was this article helpful to you? No Yes

How can we help?