/shared/shortcodes/shortcodes/callout.php

https://github.com/deltafactory/landing-pages · PHP · 167 lines · 151 code · 7 blank · 9 comment · 2 complexity · f9365d8fc78bc82c71c55cee7a5eee43 MD5 · raw file

  1. <?php
  2. /**
  3. * Call Out Shortcode
  4. */
  5. /* Shortcode generator config
  6. * ----------------------------------------------------- */
  7. $shortcodes_config['callout'] = array(
  8. 'no_preview' => true,
  9. 'options' => array(
  10. 'title' => array(
  11. 'name' => __('Title', 'leads'),
  12. 'desc' => __('Enter the heading text.', 'leads'),
  13. 'type' => 'text',
  14. 'std' => ''
  15. ),
  16. 'subtitle' => array(
  17. 'name' => __('Sub Title', 'leads'),
  18. 'desc' => __('Enter the sub title.', 'leads'),
  19. 'type' => 'textarea',
  20. 'std' => ''
  21. ),
  22. 'button_color' => array(
  23. 'name' => __('Button Color', 'leads'),
  24. 'desc' => __('Select the button color.', 'leads'),
  25. 'type' => 'select',
  26. 'options' => array(
  27. 'default' => 'Default',
  28. 'black' => 'Black',
  29. 'blue' => 'Blue',
  30. 'brown' => 'Brown',
  31. 'green' => 'Green',
  32. 'orange' => 'Orange',
  33. 'pink' => 'Pink',
  34. 'purple' => 'Purple',
  35. 'red' => 'Red',
  36. 'silver' => 'Silver',
  37. 'yellow' => 'Yellow',
  38. 'white' => 'White'
  39. ),
  40. 'std' => 'default'
  41. ),
  42. 'button_label' => array(
  43. 'name' => __('Button Text Label', 'leads'),
  44. 'desc' => __('Enter the button text label.', 'leads'),
  45. 'type' => 'text',
  46. 'std' => ''
  47. ),
  48. 'button_icon' => array(
  49. 'name' => __('Button Icon', 'leads'),
  50. 'desc' => __('Select an icon.', 'leads'),
  51. 'type' => 'select',
  52. 'options' => $fontawesome,
  53. 'std' => 'none'
  54. ),
  55. 'link' => array(
  56. 'name' => __('Link', 'leads'),
  57. 'desc' => __('Enter the button link destination URL.', 'leads'),
  58. 'type' => 'text',
  59. 'std' => ''
  60. )
  61. ),
  62. 'shortcode' => '[callout title="{{title}}" subtitle="{{subtitle}}" button_label="{{button_label}}" button_icon="{{button_icon}}" link="{{link}}"]',
  63. 'popup_title' => 'Insert Call Out Shortcode'
  64. );
  65. /* Page builder module config
  66. * ----------------------------------------------------- */
  67. $freshbuilder_modules['callout'] = array(
  68. 'name' => __('Call Out', 'leads'),
  69. 'size' => 'one_full',
  70. 'options' => array(
  71. 'title' => array(
  72. 'name' => __('Title', 'leads'),
  73. 'desc' => __('Enter the heading text.', 'leads'),
  74. 'type' => 'text',
  75. 'class' => '',
  76. 'is_content' => '0'
  77. ),
  78. 'subtitle' => array(
  79. 'name' => __('Sub Title', 'leads'),
  80. 'desc' => __('Enter the sub title.', 'leads'),
  81. 'type' => 'textarea',
  82. 'class' => '',
  83. 'is_content' => '0'
  84. ),
  85. 'button_color' => array(
  86. 'name' => __('Button Color', 'leads'),
  87. 'desc' => __('Select the button color.', 'leads'),
  88. 'type' => 'select',
  89. 'options' => array(
  90. 'default' => 'Default',
  91. 'black' => 'Black',
  92. 'blue' => 'Blue',
  93. 'brown' => 'Brown',
  94. 'green' => 'Green',
  95. 'orange' => 'Orange',
  96. 'pink' => 'Pink',
  97. 'purple' => 'Purple',
  98. 'red' => 'Red',
  99. 'silver' => 'Silver',
  100. 'yellow' => 'Yellow',
  101. 'white' => 'White'
  102. ),
  103. 'std' => 'default',
  104. 'class' => '',
  105. 'is_content' => '0'
  106. ),
  107. 'button_label' => array(
  108. 'name' => __('Button Text Label', 'leads'),
  109. 'desc' => __('Enter the button text label.', 'leads'),
  110. 'type' => 'text',
  111. 'class' => '',
  112. 'is_content' => '0'
  113. ),
  114. 'button_icon' => array(
  115. 'name' => __('Button Icon', 'leads'),
  116. 'desc' => __('Select an icon.', 'leads'),
  117. 'type' => 'select',
  118. 'options' => $fontawesome,
  119. 'std' => 'none',
  120. 'class' => '',
  121. 'is_content' => '0'
  122. ),
  123. 'link' => array(
  124. 'name' => __('Link', 'leads'),
  125. 'desc' => __('Enter the button link destination URL.', 'leads'),
  126. 'type' => 'text',
  127. 'class' => '',
  128. 'is_content' => '0'
  129. )
  130. )
  131. );
  132. /* Add shortcode
  133. * ----------------------------------------------------- */
  134. add_shortcode('callout', 'inbound_shortcode_callout');
  135. if (!function_exists('inbound_shortcode_callout')) {
  136. function inbound_shortcode_callout( $atts, $content = null ) {
  137. extract(shortcode_atts(array(
  138. 'title' => '',
  139. 'subtitle' => '',
  140. 'button_color' => '',
  141. 'button_label' => '',
  142. 'button_icon' => '',
  143. 'link' => ''
  144. ), $atts));
  145. $icon = ($button_icon) ? '<i class="icon-'. $button_icon .'"></i>&nbsp;&nbsp;' : '';
  146. $out = '';
  147. $out .= '<div class="callout clearfix">';
  148. $out .= '<div class="left">';
  149. $out .= '<h2>'. $title .'</h2>';
  150. $out .= '<div class="subtitle">'. $subtitle .'</div>';
  151. $out .= '</div>';
  152. if ($link ) :
  153. $out .= '<div class="right">';
  154. $out .= '<a class="button '. $button_color .'" href="'. $link .'">'. $icon . $button_label .'</a>';
  155. $out .= '</div>';
  156. endif;
  157. $out .= '</div>';
  158. return $out;
  159. }
  160. }