Add a new multi element ( nested shortcode ) to Avada Builder

Add a new multi element ( nested shortcode ) to Avada Builder

To add a new multi-element to Avada Builder you have to register your shortcodes as usual. Add them to Avada Builder as new elements via available helper function below.
fusion_builder_map()
In the example below, you can see a multi-element being registered. fusion_checklist shortcode is registered as a parent by providing multi and element_child attributes to
fusion_builder_map() function.
Copy to Clipboardfunction fusion_element_parent() {
fusion_builder_map( array(
'name' => esc_attr__( 'Checklist', 'fusion-builder' ),
'shortcode' => 'fusion_checklist',
'multi' => 'multi_element_parent',
'element_child' => 'fusion_li_item',
'params' => array(
array(
'type' => 'tinymce',
'heading' => esc_attr__( 'Content', 'fusion-builder' ),
'description' => esc_attr__( 'Enter some content for this contentbox.', 'fusion-builder' ),
'param_name' => 'element_content',
'value' => 'Default value',
),
),
) );
}
add_action( 'fusion_builder_before_init', 'fusion_element_parent' );

function fusion_element_child() {
fusion_builder_map( array(
'name' => esc_attr__( 'List Item', 'fusion-builder' ),
'description' => esc_attr__( 'Enter some content for this textblock', 'fusion-builder' ),
'shortcode' => 'fusion_li_item',
'hide_from_builder' => true,
'params' => array(
array(
'type' => 'tinymce',
'heading' => esc_attr__( 'List Item Content', 'fusion-builder' ),
'description' => esc_attr__( 'Add list item content.', 'fusion-builder' ),
'param_name' => 'element_content',
'value' => 'Default value',
'placeholder' => true,
),
),
) );
}
add_action( 'fusion_builder_before_init', 'fusion_element_child' );​x 1function fusion_element_parent() {2    fusion_builder_map( array(3        'name'          => esc_attr__( 'Checklist', 'fusion-builder' ),4        'shortcode'     => 'fusion_checklist',5        'multi'         => 'multi_element_parent',6        'element_child' => 'fusion_li_item',7        'params'        => array(8            array(9                'type'        => 'tinymce',10                'heading'     => esc_attr__( 'Content', 'fusion-builder' ),11                'description' => esc_attr__( 'Enter some content for this contentbox.', 'fusion-builder' ),12                'param_name'  => 'element_content',13                'value'       => 'Default value',14           ),15       ),16   ) );17}18add_action( 'fusion_builder_before_init', 'fusion_element_parent' );19​20​21function fusion_element_child() {22    fusion_builder_map( array(23        'name'              => esc_attr__( 'List Item', 'fusion-builder' ),24        'description'       => esc_attr__( 'Enter some content for this textblock', 'fusion-builder' ),25        'shortcode'         => 'fusion_li_item',26        'hide_from_builder' => true,27        'params'            => array(28            array(29                'type'        => 'tinymce',30                'heading'     => esc_attr__( 'List Item Content', 'fusion-builder' ),31                'description' => esc_attr__( 'Add list item content.', 'fusion-builder' ),32                'param_name'  => 'element_content',33                'value'       => 'Default value',34                'placeholder' => true,35           ),36       ),37   ) );38}39add_action( 'fusion_builder_before_init', 'fusion_element_child' );

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注