shortcodes.php 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <?php
  2. /**
  3. * Shortcode: Member logo slider
  4. */
  5. function build_home_slider($atts, $content = null)
  6. {
  7. ob_start(); ?>
  8. <div class="banner-slider" data-banner-slider>
  9. <button class="banner-slider-button prev" data-banner-slider-button="prev">
  10. <span class="material-symbols-outlined">
  11. arrow_back_ios
  12. </span>
  13. </button>
  14. <button class="banner-slider-button next" data-banner-slider-button="next">
  15. <span class="material-symbols-outlined">
  16. arrow_forward_ios
  17. </span>
  18. </button>
  19. <ul data-slides>
  20. <?php
  21. $i = 0;
  22. if (have_rows('home_slider_slides', 'option')) :
  23. while (have_rows('home_slider_slides', 'option')) : the_row();
  24. $bg_image = get_sub_field('bg_image');
  25. $sub_heading = get_sub_field('sub_heading');
  26. $heading_main = get_sub_field('heading_main');
  27. $text = get_sub_field('text');
  28. ?>
  29. <li class="slide" <?php if ($i == 0) {
  30. echo 'data-active';
  31. } ?>>
  32. <div class="slider-single-div">
  33. <img src="<?php echo $bg_image ?>" alt="">
  34. <div class="banner-overlay">
  35. <h4>Welcome to </h4>
  36. <h1>United<br> International<br> University</h1>
  37. <h3>
  38. Department of <br>
  39. Computer Science &amp; Engineering
  40. </h3>
  41. </div>
  42. </div>
  43. </li>
  44. <?php
  45. $i = $i + 1;
  46. endwhile;
  47. else :
  48. echo '<div class="col-xs-12">Members Logo Slider not found! <be> please add some logo in theme setting page</div>';
  49. endif;
  50. echo '</ul></div>';
  51. $output = ob_get_clean();
  52. return $output;
  53. }
  54. add_shortcode('home_slider', 'build_home_slider');
  55. /**
  56. * Shortcode: Member logo slider
  57. */
  58. function member_logo_slider($atts, $content = null)
  59. {
  60. ob_start();
  61. echo '<div class="members-logo row"> <div id="logo-slider" class="owl-carousel">';
  62. if (have_rows('members_logo', 'option')) :
  63. while (have_rows('members_logo', 'option')) : the_row();
  64. $logo_url = get_sub_field('logo');
  65. $company_link = get_sub_field('link');
  66. echo '<div class="thumbnail thumbnail-hover">';
  67. echo '<img class="img-responsive" src=" ' . $logo_url . '">';
  68. echo '<a href=" ' . $company_link . ' " " title=" ' . $company_link . ' " class="link-full"></a>';
  69. echo '</div>';
  70. endwhile;
  71. else :
  72. echo '<div class="col-xs-12">Members Logo Slider not found! <be> please add some logo in theme setting page</div>';
  73. endif;
  74. echo '</div></div>';
  75. $output = ob_get_clean();
  76. return $output;
  77. }
  78. add_shortcode('members_logo', 'member_logo_slider');