Advertisement
designbymerovingi

vc nested shortcodes

Mar 5th, 2016
194
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.50 KB | None | 0 0
  1. /**
  2. * Setup Visual Composer
  3. * @since 1.0
  4. * @version 1.0
  5. */
  6. function mycred_theme_visual_composer() {
  7.  
  8. vc_map( array(
  9. 'name' => 'Function Parameters',
  10. 'base' => 'function_params_wrap',
  11. 'content_element' => true,
  12. 'show_settings_on_create' => false,
  13. 'is_container' => true,
  14. 'as_parent' => array( 'only' => 'function_param' ),
  15. 'category' => 'Codex',
  16. 'custom_markup' => '
  17. {{ title }}
  18. <table class="table table-bordered table-condensed">
  19. <thead>
  20. <tr>
  21. <th class="codex-col-param">Param</th>
  22. <th class="codex-col-type">Type</th>
  23. <th class="codex-col-desc">Description</th>
  24. </tr>
  25. </thead>
  26. <tbody>
  27. {{ content }}
  28. </tbody>
  29. </table>
  30. ',
  31. 'params' => array(
  32.  
  33. array(
  34. 'type' => 'textfield',
  35. 'heading' => 'Extra class name',
  36. 'param_name' => 'el_class',
  37. 'description' => 'Optional'
  38. )
  39.  
  40. ),
  41. 'js_view' => 'VcRowView'
  42. ) );
  43.  
  44. vc_map( array(
  45. 'name' => 'Function Param',
  46. 'base' => 'function_param',
  47. 'content_element' => true,
  48. 'category' => 'Codex',
  49. 'as_child' => array( 'only' => 'function_params_wrap' ),
  50. 'custom_markup' => '<tr><td collspan="3">{{ content }}</td></tr>',
  51. 'params' => array(
  52.  
  53. array(
  54. 'type' => 'textfield',
  55. 'holder' => 'div',
  56. 'heading' => 'Parameter Name',
  57. 'param_name' => 'label',
  58. 'value' => ''
  59. ),
  60.  
  61. array(
  62. 'type' => 'textfield',
  63. 'holder' => 'div',
  64. 'heading' => 'Parameter Type',
  65. 'param_name' => 'type',
  66. 'value' => ''
  67. ),
  68.  
  69. array(
  70. 'type' => 'textarea',
  71. 'holder' => 'div',
  72. 'heading' => 'Description',
  73. 'param_name' => 'desc',
  74. 'value' => ''
  75. ),
  76.  
  77. array(
  78. 'type' => 'textfield',
  79. 'heading' => 'Extra class name',
  80. 'param_name' => 'el_class',
  81. 'description' => 'Optional'
  82. )
  83.  
  84. )
  85. ) );
  86.  
  87. //Your 'container' content element should extend WPBakeryShortCodesContainer class to inherit all required functionality
  88. if ( class_exists( 'WPBakeryShortCodesContainer' ) ) {
  89. class WPBakeryShortCode_function_params_wrap extends WPBakeryShortCodesContainer { }
  90. }
  91.  
  92. if ( class_exists( 'WPBakeryShortCode' ) ) {
  93. class WPBakeryShortCode_function_param extends WPBakeryShortCode { }
  94. }
  95.  
  96. }
  97. add_action( 'vc_before_init', 'mycred_theme_visual_composer' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement