Support

Account

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') ): ?>