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–>
<!–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.
The topic ‘Carousel not showing AFC Pro fields’ is closed to new replies.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.