vc_add_params()

⌘K
  1. Home
  2. Docs
  3. Inner API
  4. vc_add_params()

vc_add_params()

SINCE 4.3

This helper function is similar  to vc_add_param(), but it can accept multiple params that should be added to your content element. Basically this function will use a foreach loop for all the attributes and then vc_add_param() will be called for each single param. List of available parameters.

<?php vc_add_params( $shortcode, $attributes ); ?>

Params

Param name
Type
Description
$shortcodeStringShortcode base. For [my_shortcode] shortcode base is my_shortcode. For default “Message box” element, base is “vc_message”
$attributesArrayMultidimensional array should be defined according to vc_map() available options.

Example

How to add multiple new attributes to the default “Message box” content element:

<?php
$attributes = array(
  array(
  'type' => 'dropdown',
  'heading' => "Style",
  'param_name' => 'style',
  'value' => array( "one", "two", "three" ),
  'description' => __( "New style attribute", "my-text-domain" )
  ),
  array(
  'type' => 'dropdown',
  'heading' => "Another Style",
  'param_name' => 'another_style',
  'value' => array( "four", "five", "six" ),
  'description' => __( "New style attribute", "my-text-domain" )
  )
);
vc_add_params( 'vc_message', $attributes ); // Note: 'vc_message' was used as a base for "Message box" element
?>

 

Was this article helpful to you? No Yes

How can we help?