vc-address.php 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. <?php
  2. /*------------------------------------------------------*/
  3. /* taskereasy Heading
  4. /*------------------------------------------------------*/
  5. vc_map(array(
  6. "name" => esc_html("Address", 'taskereasy'),
  7. "base" => "taskereasy_address",
  8. 'icon' => get_template_directory_uri() . '/assets/images/favicon-icon/shortcode-icon.png',
  9. "class" => "",
  10. "description" => esc_html("Add taskereasy Address", 'taskereasy'),
  11. "category" => esc_html('Taskereasy Shortcodes', 'taskereasy'),
  12. "params" => array(
  13. array(
  14. 'type' => 'param_group',
  15. 'heading' => esc_html( 'Address', 'taskereasy' ),
  16. 'param_name' => 'address',
  17. 'params' => array(
  18. array(
  19. "type" => "textfield",
  20. "heading" => esc_html("Title", 'taskereasy'),
  21. "param_name" => "title",
  22. ),
  23. array(
  24. "type" => "textarea_safe",
  25. "heading" => esc_html("Address", 'taskereasy'),
  26. "param_name" => "subtext",
  27. ),
  28. array(
  29. "type" => "iconpicker",
  30. "heading" => esc_html("Address Icon", 'taskereasy'),
  31. "param_name" => "adrs_icon",
  32. ),
  33. array(
  34. "type" => "textfield",
  35. "heading" => esc_html("Email Address", 'taskereasy'),
  36. "param_name" => "email",
  37. ),
  38. array(
  39. "type" => "iconpicker",
  40. "heading" => esc_html("Email Icon", 'taskereasy'),
  41. "param_name" => "email_icon",
  42. ),
  43. array(
  44. "type" => "textfield",
  45. "heading" => esc_html("Phone", 'taskereasy'),
  46. "param_name" => "phone",
  47. ),
  48. array(
  49. "type" => "iconpicker",
  50. "heading" => esc_html("Phone Icon", 'taskereasy'),
  51. "param_name" => "phn_icon",
  52. ),
  53. )
  54. ),
  55. array(
  56. 'type' => 'css_editor',
  57. 'heading' => esc_html( 'CSS', 'taskereasy' ),
  58. 'param_name' => 'custom_design',
  59. 'group' => esc_html( 'Design options', 'taskereasy' ),
  60. )
  61. )
  62. ));
  63. add_shortcode( 'taskereasy_address', function($atts, $content = null) {
  64. extract(shortcode_atts(array(
  65. 'title' => ' ',
  66. 'subtext' => '',
  67. 'adrs_icon' => '',
  68. 'email' => '',
  69. 'email_icon' => '',
  70. 'phone' => '',
  71. 'phn_icon' => '',
  72. 'custom_design' => '',
  73. ), $atts));
  74. $custom_design = vc_shortcode_custom_css_class( $custom_design, ' ' );
  75. $addresslists = vc_param_group_parse_atts( $atts['address'] );
  76. $output = '';
  77. $count = 0;
  78. foreach ($addresslists as $addresslist) {
  79. $title = ($addresslists[$count]['title'])? $addresslists[$count]['title'] : ' ';
  80. $subtext = ($addresslists[$count]['subtext'])? $addresslists[$count]['subtext'] : ' ';
  81. $email = ($addresslists[$count]['email'])? $addresslists[$count]['email'] : ' ';
  82. $phone = ($addresslists[$count]['phone'])? $addresslists[$count]['phone'] : ' ';
  83. $adricon = ($addresslists[$count]['adrs_icon'])? $addresslists[$count]['adrs_icon'] : 'fa fa-map-marker';
  84. $email_icon = ($addresslists[$count]['email_icon'])? $addresslists[$count]['email_icon'] : 'fa fa-envelop';
  85. $phn_icon = ($addresslists[$count]['phn_icon'])? $addresslists[$count]['phn_icon'] : 'fa fa-mobile';
  86. $output .='
  87. <div class="address-wrap">
  88. <h4>'.esc_html($title).'</h4>
  89. <div class="address">
  90. <i class="'.esc_html($adricon).'"></i>
  91. <p>'.esc_html($subtext).' </p>
  92. </div>
  93. <div class="email">
  94. <i class="'.esc_html($email_icon).'"></i>
  95. <p><a href="'.esc_html($email).'">'.esc_html($email).'</a></p>
  96. </div>
  97. <div class="phone">
  98. <i class="'.esc_html($phn_icon).'"></i>
  99. <p>'.esc_html($phone).' </p>
  100. </div>
  101. </div>';
  102. $count++;
  103. }
  104. return $output;
  105. });