I am trying to add an ID attribute to row in Visual Composer via documented function vc_add_param()
in such a way:
$attributes = array(
'type' => 'textfield',
'heading' => "HTML ID",
'param_name' => 'el_id',
'value' => '',
'description' => __( "Assign an ID to the row", "discprofile" )
);
vc_add_param( 'vc_row', $attributes );
ID field appears when I edit a row. I set a value, save it, save page, view it, but there is no affect to frontend. A row still has no ID attribute.
I’ve also tried use 'param_name' => 'id'
and 'param_name' => 'element_id'
, it was the same. What is wrong?
Solution:
We have to remap a shortcode and change its template to add additional parameters.
So, in my case:
We included templates/vc_rows.php file. It is the row template file, copied from plugins/js_composer/include/templates/shortcodes/vc_rows.php with some changes. Here it is: