Support

Account

Home Forums ACF PRO Carousel not showing AFC Pro fields

Helping

Carousel not showing AFC Pro fields

  • I Have the following code in template parts, file named slider. The custom fields are ‘slides’ in the home – front page. None of the custom fields are displaying. Any suggestions would prevent hair loss and much grattitude.

    <section id=”carouselJourney”>
    <div class=”container”>
    <div class=”row”>

    <div id=”content” class=”col-sm-12″>
    <?php if( have_rows(‘slides’, ‘option’) ) : ?>
    <div id=”carouselJourneyIndicators” class=”carousel slide” data-ride=”carousel”>

    <!– Indicators–>

      <?php while( have_rows(‘slides’, ‘option’) ): the_row();
      // vars
      $number = 0;
      ?>
      <li data-target=”#carouselJourneyIndicators” data-slide-to=”<?php echo $number; ?>” class=”<?php if ($number == 0): echo (‘active’); endif; ?>”>
      <?php $number++;
      endwhile; ?>

    <!–end indicators–>

    <!– Slides–>
    <div class=”carousel-inner”>
    <?php while( have_rows(‘slides’) ): the_row();

    // vars

    $slide_picture = get_sub_field(‘slide_picture’);
    $slide_caption_heading = get_sub_field(‘slide_caption_heading’);
    $slide_caption_description = get_sub_field(‘slide_caption_description’);
    $slide_link = get_sub_field(‘slide_link’);
    $slide_link_text = get_sub_field(‘slide_link_text’);

    ?>

    <div class=”carousel-item <?php if($number == 0): echo (‘active’); endif; ?>”>
    <!– If user uploaded an image–>
    <?php if( !empty($slide_picture) ): ?>
    ” alt=”<?php echo $slide_picture[‘alt’] ?>”>
    <?php endif; ?>

    <div class=”carousel-caption d-none d-md-block”>
    <h5><?php echo $slide_caption_heading; ?></h5>
    <p><?php echo $slide_caption_description; ?>“><?php echo $slide_link_text; ?></p>
    </div>
    </div>
    <?php endwhile; wp_reset_query(); ?>
    </div><!–end of slides–>
    <?php endif; ?>

    <span class=”carousel-control-prev-icon” aria-hidden=”true”></span>
    <span class=”sr-only”>Previous</span>


    <span class=”carousel-control-next-icon” aria-hidden=”true”></span>
    <span class=”sr-only”>Next</span>

    </div>

    </div>

    </div>

    </div>
    </section><!–carousel–>

  • Made some progress, removed the $number++ and the if statement around echo $slide_picture.

    Slides appear but stacked vertically, not as a carousel.

Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Carousel not showing AFC Pro fields’ is closed to new replies.