vc-logos.php 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. <?php
  2. /*------------------------------------------------------*/
  3. /* taskereasy Heading
  4. /*------------------------------------------------------*/
  5. vc_map(array(
  6. "name" => esc_html__("Static Logos", 'taskereasy'),
  7. "base" => "taskereasy_logos",
  8. 'icon' => get_template_directory_uri() . '/assets/images/favicon-icon/shortcode-icon.png',
  9. "class" => "",
  10. "description" => esc_html__("Add taskereasy logos", 'taskereasy'),
  11. "category" => esc_html__('Taskereasy Shortcodes', 'taskereasy'),
  12. "params" => array(
  13. array(
  14. "type" => "dropdown",
  15. "heading" => esc_html__("Style", 'taskereasy'),
  16. "param_name" => "style",
  17. "value" => array('Style 1' => 'style_1', 'Style 2' => 'style_2'),
  18. ),
  19. array(
  20. "type" => "attach_images",
  21. "heading" => esc_html__("Images", 'taskereasy'),
  22. "param_name" => "images",
  23. ),
  24. array(
  25. "type" => "textfield",
  26. "heading" => esc_html__("Title", 'taskereasy'),
  27. "param_name" => "title",
  28. "dependency" => array(
  29. "element" => "style",
  30. "value" => "style_2"
  31. ),
  32. ),
  33. array(
  34. "type" => "textarea_safe",
  35. "heading" => esc_html__("Subtitle", 'taskereasy'),
  36. "param_name" => "subtext",
  37. "dependency" => array(
  38. "element" => "style",
  39. "value" => "style_2"
  40. ),
  41. ),
  42. array(
  43. 'type' => 'css_editor',
  44. 'heading' => esc_html__( 'CSS', 'taskereasy' ),
  45. 'param_name' => 'custom_design',
  46. 'group' => esc_html__( 'Design options', 'taskereasy' ),
  47. )
  48. )
  49. ));
  50. add_shortcode( 'taskereasy_logos', function($atts, $content = null) {
  51. extract(shortcode_atts(array(
  52. 'style' => 'style_1',
  53. 'images' => '',
  54. 'title' => '',
  55. 'subtext' => '',
  56. 'custom_design' => '',
  57. ), $atts));
  58. $custom_design = vc_shortcode_custom_css_class( $custom_design, ' ' );
  59. $image_ids = explode(',', $images);
  60. $image_no = 1;
  61. $output = '';
  62. if($style == "style_1"){
  63. $output .='
  64. <div id="our-clients">
  65. <ul class="'.$custom_design.'">';
  66. foreach( $image_ids as $image_id ){
  67. $images = wp_get_attachment_image_src( $image_id, 'thumbnail' );
  68. $output .=' <li><img src="'.esc_url($images[0]).'" alt="image"></li>';
  69. $image_no++;
  70. }
  71. $output .=' </ul>
  72. </div>';
  73. }else{
  74. $output.=
  75. '<div class="partners-logo3">
  76. <div class="row">
  77. <div class="col col-12 col-lg-3 col-md-4">
  78. <div class="partner-title-wrpr">
  79. <h3 class="partner-title">'.$title.'</h3>
  80. <p>'.$subtext.'</p>
  81. </div>
  82. </div>
  83. <div class="col col-12 col-lg-9 col-md-8">
  84. <div class="row partner-logo3-inner">';
  85. foreach( $image_ids as $image_id ){
  86. $images = wp_get_attachment_image_src( $image_id, 'thumbnail' );
  87. $output.=
  88. '<div class="col col-12 col-md-3">
  89. <div class="partner-img-wrpr">
  90. <img src="'.esc_url($images[0]).'" alt="PARTNERS LOGO">
  91. </div>
  92. </div>';
  93. $image_no++;
  94. }
  95. $output.='
  96. </div>
  97. </div>
  98. </div>
  99. </div>';
  100. }
  101. return $output;
  102. });