shortcodes.php 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?php
  2. /**
  3. * Shortcode: Member logo slider
  4. */
  5. function build_home_slider($atts, $content = null)
  6. {
  7. ob_start();
  8. echo '<div class="members-logo row"> <div id="logo-slider" class="owl-carousel">';
  9. if (have_rows('members_logo', 'option')) :
  10. while (have_rows('members_logo', 'option')) : the_row();
  11. $logo_url = get_sub_field('logo');
  12. $company_link = get_sub_field('link');
  13. echo '<div class="thumbnail thumbnail-hover">';
  14. echo '<img class="img-responsive" src=" ' . $logo_url . '">';
  15. echo '<a href=" ' . $company_link . ' " " title=" ' . $company_link . ' " class="link-full"></a>';
  16. echo '</div>';
  17. endwhile;
  18. else :
  19. echo '<div class="col-xs-12">Members Logo Slider not found! <be> please add some logo in theme setting page</div>';
  20. endif;
  21. echo '</div></div>';
  22. $output = ob_get_clean();
  23. return $output;
  24. }
  25. add_shortcode('home_slider', 'build_home_slider');
  26. /**
  27. * Shortcode: Member logo slider
  28. */
  29. function member_logo_slider($atts, $content = null)
  30. {
  31. ob_start();
  32. echo '<div class="members-logo row"> <div id="logo-slider" class="owl-carousel">';
  33. if (have_rows('members_logo', 'option')) :
  34. while (have_rows('members_logo', 'option')) : the_row();
  35. $logo_url = get_sub_field('logo');
  36. $company_link = get_sub_field('link');
  37. echo '<div class="thumbnail thumbnail-hover">';
  38. echo '<img class="img-responsive" src=" ' . $logo_url . '">';
  39. echo '<a href=" ' . $company_link . ' " " title=" ' . $company_link . ' " class="link-full"></a>';
  40. echo '</div>';
  41. endwhile;
  42. else :
  43. echo '<div class="col-xs-12">Members Logo Slider not found! <be> please add some logo in theme setting page</div>';
  44. endif;
  45. echo '</div></div>';
  46. $output = ob_get_clean();
  47. return $output;
  48. }
  49. add_shortcode('members_logo', 'member_logo_slider');