ACF Repeater PHP Template for repeated Image

This is my template:

<?php
/*
Template Name: News Page
*/
?>

<?php include 'header.php'; ?>

<?php while ( have_posts() ) : the_post(); ?>

<div class="col-md-10">
    <div class="bio">


        <?php           
            if(have_rows('news_article')):
                while(have_rows('news_article')): the_row();?>

                    <?php if(get_sub_field("image")): ?>
                        <div class="row bottom-margin">
                            <div class="col-md-offset-1 col-md-7">
                                <img src="<?php the_sub_field('image');?>" class='img-responsive'>
                            </div>
                        </div>
                        <div class="row bottom-margin">
                            <div class="col-md-9">
                                <hr class="news-hr">
                            </div>
                        </div>    
                    <?php endif; // end of if field_name logic ?>   

                <?php endwhile;?>
            <?php endif;?>  

    </div>
</div>

<?php endwhile; // end of the loop. ?>

<?php include 'footer.php'; ?>

But when I load the page nothing displays but the header? I have setup the Custom Fields page, there is one repeater: “news_article” and within that one image: “image”?

Related posts

Leave a Reply

1 comment

  1. Please check the documentation for the ACF Image Field type. I would check to make sure that your “image” sub field return value is set to “Image URL” with how you are using your code.

    enter image description here

    Please let me know if this works for you.