vc-icon-text.php 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. <?php
  2. /*------------------------------------------------------*/
  3. /* taskereasy Heading
  4. /*------------------------------------------------------*/
  5. vc_map(array(
  6. "name" => esc_html__("Icon with text", 'taskereasy'),
  7. "base" => "taskereasy_icon_text",
  8. 'icon' => get_template_directory_uri() . '/assets/images/favicon-icon/shortcode-icon.png',
  9. "class" => "",
  10. "description" => esc_html__("Add taskereasy image with text", 'taskereasy'),
  11. "category" => esc_html__('Taskereasy Shortcodes', 'taskereasy'),
  12. "params" => array(
  13. array(
  14. "type" => "param_group",
  15. "heading" => esc_html__("Icon List", 'taskereasy'),
  16. "param_name" => "icon_list",
  17. "params" => array(
  18. array(
  19. "type" => "iconpicker",
  20. "heading" => esc_html__("Icon", 'taskereasy'),
  21. "param_name" => "icon",
  22. ),
  23. array(
  24. "type" => "textfield",
  25. "heading" => esc_html__("Title", 'taskereasy'),
  26. "param_name" => "title",
  27. ),
  28. array(
  29. "type" => "textarea_safe",
  30. "heading" => esc_html__("Subtitle", 'taskereasy'),
  31. "param_name" => "subtext",
  32. ),
  33. array(
  34. 'type' => 'colorpicker',
  35. 'heading' => esc_html__( 'Icon Background', 'taskereasy' ),
  36. 'param_name' => 'icon_color',
  37. ),
  38. ),
  39. ),
  40. array(
  41. 'type' => 'colorpicker',
  42. 'heading' => esc_html__( 'Description Color', 'taskereasy' ),
  43. 'param_name' => 'des_color',
  44. 'group' => esc_html__( 'Custom Design', 'taskereasy' )
  45. ),
  46. array(
  47. 'type' => 'css_editor',
  48. 'heading' => esc_html__( 'CSS', 'taskereasy' ),
  49. 'param_name' => 'custom_design',
  50. 'group' => esc_html__( 'Design options', 'taskereasy' ),
  51. )
  52. )
  53. ));
  54. add_shortcode( 'taskereasy_icon_text', function($atts, $content = null) {
  55. extract(shortcode_atts(array(
  56. 'icon' => '',
  57. 'title' => '',
  58. 'subtext' => '',
  59. 'icon_color' => '#000000',
  60. 'custom_design' => '',
  61. ), $atts));
  62. $custom_design = vc_shortcode_custom_css_class( $custom_design, ' ' );
  63. $iconlists = vc_param_group_parse_atts( $atts['icon_list'] );
  64. $output = '';
  65. $count = 0;
  66. $output .= '<ul>';
  67. foreach ($iconlists as $iconlist) {
  68. $output .= '<li>
  69. <div class="list_icon" style="background-color:'.esc_attr($iconlists[$count]['icon_color']).';">
  70. <i class="'.esc_attr($iconlists[$count]['icon']).'"></i>
  71. </div>
  72. <h6>'.esc_html($iconlists[$count]['title']).'</h6>
  73. <p>'.esc_html($iconlists[$count]['subtext']).'</p>
  74. </li>';
  75. $count++;
  76. }
  77. $output .= '</ul>';
  78. return $output;
  79. });