Question

Ive uploaded images to a page in wordpress using the ACF Repeater plugin. The slide transition is working fine but my are not showing. Can anyone help with this ...

The custom field is called 'slides' and there are three images attached to the my home.php page.

Here is my code.

<div id="flexslider_main" class="flexslider">
<ul class="slides">
  <?php if (have_posts()) : ?>
      <?php while (have_posts()) : the_post(); ?>
        <?php $slides = get_field('slides');
        $i = 1;

 foreach ($slides as $slide){?>
 <li>
 <img src="<?php echo $slide['image']; ?>" class="slide_image img<?php echo slides; ?>"/>
 </li>

<?php $i++;
} ?>

<?php endwhile; else: echo 'No slide images found'; ?>
<?php endif; ?>
</ul>
</div>
<!--Flex Slider-->  
Was it helpful?

Solution

From what I can see, you aren't calling the sub-fields, and you removed the "rows" and changed everything to read to "slides"... this is the code I commonly use on the sliders.

<?php
    $rows = get_field('slides';
        if($rows) {
            foreach($rows as $row)
                  {
 ?>
     <li><img src="<?=$row['image']?>" alt=""></li>        
                    <?
                        }
                        }
?>

The area that says 'image' is replaced by the sub-field name. Also make sure that you're setting your "Return Value" on the field options to Image URL.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top