To add a custom preview template to your Avada Builder element, you first have to register your shortcode as usual. You can then add your element shortcodes to the Avada Builder as new elements via this helper function: fusion_builder_map()
In the example below you can see a custom preview template being registered. Template is registered by providing preview and preview_id attributes to the
fusion_builder_map() function.
Copy to Clipboardfunction my_fusion_element() {
fusion_builder_map( array(
'name' => esc_attr__( 'Pricing Table', 'fusion-builder' ),
'shortcode' => 'fusion_pricing_table',
'preview' => FUSION_BUILDER_PLUGIN_DIR . 'inc/templates/previews/fusion-pricing-table-preview.php',
'preview_id' => 'pricing-table-preview-template',
'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', 'my_fusion_element' );
x 1function my_fusion_element() {2 fusion_builder_map( array(3 'name' => esc_attr__( 'Pricing Table', 'fusion-builder' ),4 'shortcode' => 'fusion_pricing_table',5 'preview' => FUSION_BUILDER_PLUGIN_DIR . 'inc/templates/previews/fusion-pricing-table-preview.php',6 'preview_id' => 'pricing-table-preview-template',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', 'my_fusion_element' );1920