Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2019
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.76 KB | None | 0 0
  1. <?php
  2.  
  3. // *Repeater
  4. // carousel_repeater
  5. // *Sub-Fields
  6. // carousel_image
  7. // carousel_text
  8.  
  9. // check if the repeater field has rows of data
  10. if( have_rows('carousel_repeater') ):
  11. $i = 0; // Set the increment variable
  12.  
  13. echo '<div id="carouselExampleSlidesNav3" class="carousel slide" data-ride="carousel">
  14. <ol class="carousel-indicators">';
  15.  
  16. // loop through the rows of data for the tab header
  17. while ( have_rows('carousel_repeater') ) : the_row();
  18. ?>
  19.  
  20. <li data-target="#carouselExampleSlidesNav3" data-slide-to="<?php echo $i;?>" class="<?php if($i == 0) echo 'active';?>"></li>
  21.  
  22. <?php $i++; // Increment the increment variable
  23.  
  24. endwhile; //End the loop
  25.  
  26. echo '</ol>
  27. <div class="carousel-inner">';
  28.  
  29. // loop through the rows of data for the tab header
  30. $i = 0; // Set the increment variable
  31. while ( have_rows('carousel_repeater') ) : the_row();
  32.  
  33. $image = get_sub_field('carousel_image');
  34. $text = get_sub_field('carousel_text');
  35.  
  36. ?>
  37.  
  38. <div class="carousel-item <?php if($i == 0) echo 'active';?>">
  39. <img class="d-block w-100" src="<?php echo $image['url']; ?>" alt="<?php echo $image['title']; ?>">
  40. </div>
  41.  
  42.  
  43. <?php $i++; // Increment the increment variable
  44.  
  45. endwhile; //End the loop
  46.  
  47. echo '</div>
  48. <a class="carousel-control-prev" href="#carouselExampleSlidesNav3" role="button" data-slide="prev">
  49. <span class="carousel-control-prev-icon" aria-hidden="true"></span>
  50. <span class="sr-only">Previous</span>
  51. </a>
  52. <a class="carousel-control-next" href="#carouselExampleSlidesNav3" role="button" data-slide="next">
  53. <span class="carousel-control-next-icon" aria-hidden="true"></span>
  54. <span class="sr-only">Next</span>
  55. </a>
  56. </div>';
  57.  
  58. else :
  59.  
  60. // no rows found
  61.  
  62. endif;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement