I want to create custom element in Visual composer which will add 2 images inside vc_single_image For example:
<div class="vc_single_image-wrapper vc_box_border_grey">
<img src="img/macbook.png" class="vc_single_image-img attachment-full">
<img src="img/tmp/mac-ins.png" class="vc_single_image-img attachment-full template-mac--ins">
</div>
In my functions.php I do following:
function vc_before_init_actions() {
if( function_exists('vc_set_shortcodes_templates_dir') ){
vc_set_shortcodes_templates_dir( get_template_directory() . '/vc-elements' );
}
}
add_action( 'vc_after_init', 'vc_after_init_actions' );
function vc_after_init_actions() {
$vc_single_image_new_params = array(
array(
'type' => 'attach_image',
'heading' => __( 'Second Image', 'js_composer' ),
'param_name' => 'secondImage',
'value' => '',
'description' => __( 'If you need use 2 image inside one "single image"', 'js_composer' ),
'dependency' => array(
'element' => 'source',
'value' => 'media_library',
),
'admin_label' => true,
'group' => 'Addititonal',
),
);
vc_add_params( 'vc_single_image', $vc_single_image_new_params );
}
And I've copied file form js_composer/include/shortcodesvc_single_images to MyTheme/vc-elements/ and after it I change html structure of this file (add new varible "secondImage").
Problem: When I create this element in VP and add new images (1 from origin panel and other from my custom) I tried to update page, Well, after updating nothing save.
What's wrong??
Well, if you have the same problems you MUST know that the name of a field MUST NOT HAVE upper case letters at all. So, 'param_name' => 'second_image'
or 'param_name' => 'secondimage'