danstramer

Slick slider - display title of next slide

May 25th, 2020
792
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.45 KB | None | 0 0
  1. <section class="hp-slider">
  2. <div class="home-slider">
  3.       <?php if( have_rows('home-slider') ): ?>
  4.           <?php while( have_rows('home-slider') ): the_row(); ?>
  5.           <?php
  6.                   $imageArray = get_sub_field('image');
  7.                   $imageURL = $imageArray['url'];
  8.        
  9.                 $myslides = get_post_meta( get_the_ID(), 'be_slides', true );
  10.                 for( $i = 0; $i < $myslides; $i++) {
  11.    
  12.     ?>
  13.  
  14.          
  15.  <div class="slide-item hero-slider" style="background-image: url(<?php echo $imageURL; ?>)" data-title="<?php the_sub_field('hero-title'); ?>">
  16.            <div class="slider-content">
  17.                <div class="content-wrapper">
  18.           <h2><?php the_sub_field('subtitle');?></h2>
  19.         <h1 class="herohead"> <a href="<?php the_sub_field('hero-url');?>"> <?php the_sub_field('hero-title'); ?></a></h1>
  20.            <div class="hero-content"><?php the_sub_field('hero-content'); ?></div>
  21.                </div>
  22.                
  23.        </div>
  24.            </div>
  25.    
  26. <?php  
  27.     $next_title = get_post_meta( get_the_ID(), 'be_slides_' . $i + 1 . '_title', true );
  28. if( !empty( $next_title ) )
  29. echo 'Next: ' . $next_title;
  30. }
  31. ?>
  32.         <?php endwhile; ?>
  33.       <?php endif; ?>
  34.    
  35.   </div> <!-- .index-slider -->
  36. <div class="slider-nav">
  37.     <div class="title-cont"><?php echo 'Next: ' . $next_title;?></div>
  38.     <button class="prev slick-arrow"> <i class="icon-arrow-left"></i> </button>
  39.     <button class="next slick-arrow"> <i class="icon-arrow-right"></i> </button>
  40. </div>
  41.  
  42. </section>
Add Comment
Please, Sign In to add comment