Skip to content

Instantly share code, notes, and snippets.

Last active November 23, 2017 07:11
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save mwender/66c484a45da924d915b5 to your computer and use it in GitHub Desktop.
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' );
Copy link

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