vc-testimonials.php 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185
  1. <?php
  2. /*------------------------------------------------------*/
  3. /* taskereasy Testimonials
  4. /*------------------------------------------------------*/
  5. vc_map(array(
  6. "name" => esc_html__("Testimonials", 'taskereasy'),
  7. "base" => "taskereasy_testimonials",
  8. 'icon' => get_template_directory_uri() . '/assets/images/favicon-icon/shortcode-icon.png',
  9. "class" => "",
  10. "description" => esc_html__("Add taskereasy Testimonials", 'taskereasy'),
  11. "category" => esc_html__('Taskereasy Shortcodes', 'taskereasy'),
  12. "params" => array(
  13. array(
  14. 'type' => 'dropdown',
  15. 'heading' => esc_html__( 'Columns', 'taskereasy' ),
  16. 'param_name' => 'testi_col',
  17. 'value' => array('Single' => 'single', 'Multiple' => 'multi'),
  18. ),
  19. array(
  20. 'type' => 'dropdown',
  21. 'heading' => esc_html__( 'Style', 'taskereasy' ),
  22. 'param_name' => 'style',
  23. 'value' => array('Style One' => 'style_1', 'Style Two' => 'style_2'),
  24. 'dependency' => array(
  25. 'element' => 'testi_col',
  26. 'value' => 'single'
  27. )
  28. ),
  29. array(
  30. "type" => "param_group",
  31. "heading" => esc_html__("Testimonial", 'taskereasy'),
  32. "param_name" => "testimonial",
  33. "params" => array(
  34. array(
  35. "type" => "attach_image",
  36. "heading" => esc_html__("Image", 'taskereasy'),
  37. "param_name" => "image",
  38. ),
  39. array(
  40. 'type' => 'textfield',
  41. 'heading' => esc_html__( 'Author', 'taskereasy' ),
  42. 'param_name' => 'author',
  43. ),
  44. array(
  45. "type" => "textarea_safe",
  46. "heading" => esc_html__("Description", 'taskereasy'),
  47. "param_name" => "description",
  48. ),
  49. array(
  50. 'type' => 'textfield',
  51. 'heading' => esc_html__( 'Position', 'taskereasy' ),
  52. 'param_name' => 'position',
  53. ),
  54. ),
  55. ),
  56. array(
  57. 'type' => 'css_editor',
  58. 'heading' => esc_html__( 'CSS', 'taskereasy' ),
  59. 'param_name' => 'custom_design',
  60. 'group' => esc_html__( 'Design options', 'taskereasy' ),
  61. )
  62. )
  63. ));
  64. add_shortcode( 'taskereasy_testimonials', function($atts, $content = null) {
  65. extract(shortcode_atts(array(
  66. 'testi_col' => 'single',
  67. 'style' => 'style_1',
  68. 'image' => '',
  69. 'description' => '',
  70. 'author' => '',
  71. 'position' => '',
  72. 'align' => '',
  73. 'title_heading' => 'h1',
  74. 'titlecolor' => '',
  75. 'title_align' => '',
  76. 'description_color' => '',
  77. 'custom_design' => '',
  78. ), $atts));
  79. $custom_design = vc_shortcode_custom_css_class( $custom_design, ' ' );
  80. $output = '';
  81. $count = 0;
  82. $testimonials = vc_param_group_parse_atts( $atts['testimonial'] );
  83. $testicol = html_entity_decode(vc_value_from_safe($testi_col, true));
  84. $test_id = ($testicol == 'multi') ? 'testimonialsTwo' : 'testimonials';
  85. $output .= '<div id="'.$test_id.'" class="'.$style.'">';
  86. if($testicol == 'single' ){
  87. if(empty($style) || $style == 'style_1'){
  88. $output .='<div class="owl-carousel">';
  89. foreach ($testimonials as $testimonial) {
  90. $img_id = $testimonials[$count]['image'];
  91. $imgurl = wp_get_attachment_image_src($img_id);
  92. $output .= '<div class="item">
  93. <div class="reviews-box">';
  94. if($imgurl[0]){
  95. $output .='<div class="client-imge"> <img src="'.$imgurl[0].'" alt="image"> </div>';
  96. }
  97. $output .= '<div class="review-box-inner"><h6>'.$testimonials[$count]['author'].'</h6>
  98. <div class="client-m">'.$testimonials[$count]['position'].'</div>
  99. <p>'.$testimonials[$count]['description'].'</p></div>
  100. </div> </div>';
  101. $count++;
  102. }
  103. $output .= '</div>';
  104. }else{
  105. $output .='<div class="testimonial-slider">';
  106. foreach ($testimonials as $testimonial) {
  107. $img_id = $testimonials[$count]['image'];
  108. $imgurl = wp_get_attachment_image_src($img_id);
  109. $output .= '
  110. <div class="testimonial-items">
  111. <div class="users-quote">
  112. '.$testimonials[$count]['description'].'
  113. </div>
  114. <div class="users-profile">
  115. <div class="users-img-inner">';
  116. if($imgurl[0]){
  117. $output .='<img src="'.$imgurl[0].'" alt="image">';
  118. }
  119. $output.='
  120. </div>
  121. <div class="users-info">
  122. <p class="user-name"><b>'.$testimonials[$count]['author'].'</b></p>
  123. <p class="user-state">'.$testimonials[$count]['position'].'</p>
  124. <p class="user-rating"><i class="fa fa-star" aria-hidden="true"></i><i class="fa fa-star" aria-hidden="true"></i><i class="fa fa-star" aria-hidden="true"></i><i class="fa fa-star" aria-hidden="true"></i></p>
  125. </div>
  126. </div>
  127. </div>';
  128. $count++;
  129. }
  130. $output .='</div>';
  131. }
  132. }else{
  133. $output .='<div class="owl-carousel">';
  134. foreach ($testimonials as $testimonial) {
  135. $img_id = $testimonials[$count]['image'];
  136. $imgurl = wp_get_attachment_image_src($img_id);
  137. $output .= '<div class="item">
  138. <div class="testimonial-wrap">
  139. <div class="testimonial-header">
  140. <div class="testimonial-img">';
  141. if($imgurl[0]){
  142. $output .= '<img src="'.$imgurl[0].'" alt="image">';
  143. }
  144. $output .= '</div>
  145. <h6>'.$testimonials[$count]['author'].'</h6>
  146. <p>'.$testimonials[$count]['position'].'</p>
  147. <div class="ratings">
  148. <i class="fa fa-star active"></i>
  149. <i class="fa fa-star active"></i>
  150. <i class="fa fa-star active"></i>
  151. <i class="fa fa-star active"></i>
  152. <i class="fa fa-star"></i>
  153. </div>
  154. </div>
  155. <div class="testimonial-body">
  156. <p>'.$testimonials[$count]['description'].'</p>
  157. </div>
  158. </div>
  159. </div>';
  160. $count++;
  161. }
  162. $output .= '</div>';
  163. }
  164. $output .= '</div>';
  165. return $output;
  166. });