How to extend visual composer with custom post as element


Staff member
I installed visual composer in my wordpress website. I need to add an custom post type as an element in visual composer and need to map the template file to the created custom post type element in visual composer.

add_action( 'vc_before_init', 'vc_extend_func' );
function vc_extend_func() {
   vc_map( array(
      "name" => __( "Testing", "my-text-domain" ),
      "base" => "test",
      "class" => "",
      "category" => __( "Content", "my-text-domain"),
   ) );

This piece of code created the element in visual composer. My question is how to map a template to this element.

$dir = get_stylesheet_directory() . '/vc_templates';
vc_set_shortcodes_templates_dir( $dir );

I also overwrite the default shortcode template path. But I didn't get the desired result. Kindly, provide solution to map the template for the created to post type.
Thanks in Advance.