Home › Forums › Add-ons › Repeater Field › Trouble retrieving File URL in Repeater Field › Reply To: Trouble retrieving File URL in Repeater Field
It is set to ‘File Object’. Using an example from the link you provided, I slightly modified the code, but it still doesn’t work:
<?php
// check for rows (parent repeater)
if( have_rows('downloads') ): ?>
<div id="downloads">
<?php
// loop through rows (parent repeater)
while( have_rows('downloads') ): the_row();
?>
<div class="downloads-title">
<h3><?php the_sub_field('downloads_title'); ?></h3>
<i class="downloads-border"></i>
<?php
// check for rows (sub repeater)
if( have_rows('documents') ):
?>
<ul class="fa-ul">
<?php
// loop through rows (sub repeater)
while( have_rows('documents') ): the_row();
// display each item as a list - with a class of completed ( if completed )
$file = get_sub_field('document_upload');
?>
<li><i class="fa-li fa fa-download"></i><a href="<?php echo $file['url']; ?>"><?php the_sub_field('document_name'); ?></a></li>
<?php endwhile; ?>
</ul>
<?php endif; //if( get_sub_field('documents') ): ?>
</div>
<?php endwhile; // while( have_rows('downloads') ): ?>
</div>
<?php endif; // if( have_rows('downloads') ): ?>
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.