Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Setup Visual Composer
- * @since 1.0
- * @version 1.0
- */
- function mycred_theme_visual_composer() {
- vc_map( array(
- 'name' => 'Function Parameters',
- 'base' => 'function_params_wrap',
- 'content_element' => true,
- 'show_settings_on_create' => false,
- 'is_container' => true,
- 'as_parent' => array( 'only' => 'function_param' ),
- 'category' => 'Codex',
- 'custom_markup' => '
- {{ title }}
- <table class="table table-bordered table-condensed">
- <thead>
- <tr>
- <th class="codex-col-param">Param</th>
- <th class="codex-col-type">Type</th>
- <th class="codex-col-desc">Description</th>
- </tr>
- </thead>
- <tbody>
- {{ content }}
- </tbody>
- </table>
- ',
- 'params' => array(
- array(
- 'type' => 'textfield',
- 'heading' => 'Extra class name',
- 'param_name' => 'el_class',
- 'description' => 'Optional'
- )
- ),
- 'js_view' => 'VcRowView'
- ) );
- vc_map( array(
- 'name' => 'Function Param',
- 'base' => 'function_param',
- 'content_element' => true,
- 'category' => 'Codex',
- 'as_child' => array( 'only' => 'function_params_wrap' ),
- 'custom_markup' => '<tr><td collspan="3">{{ content }}</td></tr>',
- 'params' => array(
- array(
- 'type' => 'textfield',
- 'holder' => 'div',
- 'heading' => 'Parameter Name',
- 'param_name' => 'label',
- 'value' => ''
- ),
- array(
- 'type' => 'textfield',
- 'holder' => 'div',
- 'heading' => 'Parameter Type',
- 'param_name' => 'type',
- 'value' => ''
- ),
- array(
- 'type' => 'textarea',
- 'holder' => 'div',
- 'heading' => 'Description',
- 'param_name' => 'desc',
- 'value' => ''
- ),
- array(
- 'type' => 'textfield',
- 'heading' => 'Extra class name',
- 'param_name' => 'el_class',
- 'description' => 'Optional'
- )
- )
- ) );
- //Your 'container' content element should extend WPBakeryShortCodesContainer class to inherit all required functionality
- if ( class_exists( 'WPBakeryShortCodesContainer' ) ) {
- class WPBakeryShortCode_function_params_wrap extends WPBakeryShortCodesContainer { }
- }
- if ( class_exists( 'WPBakeryShortCode' ) ) {
- class WPBakeryShortCode_function_param extends WPBakeryShortCode { }
- }
- }
- add_action( 'vc_before_init', 'mycred_theme_visual_composer' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement