Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Add an HTML ID option to Visual Composer rows in the X Theme
function x_child_visual_composer_update_existing_shortcodes(){
if ( function_exists( 'vc_add_param' ) ) {
vc_add_param( 'vc_row', array(
'type' => 'textfield',
'heading' => "HTML ID",
'param_name' => 'element_id',
'value' => '',
'description' => __( "Assign an ID to the row", "discprofile" ),
) );
// Update 'vc_row' to include custom vc_row template and remap shortcode
$new_map = vc_map_update( 'vc_row', array( 'html_template' => locate_template( 'vc_templates/vc_row.php' ) ) );
// Remove default vc_row
vc_remove_element( 'vc_row' );
// Remap shortcode with custom template
vc_map( $new_map['vc_row'] );
add_action( 'wp_loaded', 'x_child_visual_composer_update_existing_shortcodes' );

This comment has been minimized.

Copy link

allurewebsolutions commented Mar 1, 2017

I'm getting the following error when trying to use this function: Fatal error: Wrong vc_map object. Base attribute is required

Do you have any ideas?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.