add_shortcode('shortcode-name', function($params){
include(get_template_directory() . '/path/to/shortcode.php');
});
add_action( 'vc_after_init', 'add_shortcode');
function add_shortcode() {
include(get_template_directory() . '/vc_templates/vc_shortcode.php');
}
vc_map( array(
"name" => __("Component Name"),
"base" => "shortcode-name",
"category" => __('Content'),
"params" => [
[
"type" => "textfield",
"heading" => __("Service Title"),
"param_name" => "title",
],
[
"type" => "textarea_html",
"heading" => __("Top Treatments"),
"param_name" => "content",
],
[
"type" => "attach_image",
"heading" => __("Card Image"),
"param_name" => "image",
],
[
"type" => "vc_link",
"heading" => __("Learn More Button Link"),
"param_name" => "button_link"
],
]
));
<?php
extract(shortcode_atts([
'title' => null,
'content' => null,
'image' => null,
'link' => null,
], $params));