Support

Account

Home Forums Add-ons Repeater Field Display Title of File in href using Repeater Reply To: Display Title of File in href using Repeater

  • Hi @elliot

    Screenshots attached, top level field is called “testlabel” with repeater. Subfield level is called “testsubfield” with file.

    The file field “testsubfield” is set to File ID.

    They are attached to display on a custom post type called “acts”. The code I’m using is below which includes your last replies suggestions. When I made this field it didn’t show 75 results show just ignoring the problem for now.

    Thanks

    
    <?php 
    $attachment_id = get_sub_field('testsubfield');
    $url = wp_get_attachment_url( $attachment_id );
    $title = get_the_title( $attachment_id );
    ?>
            
            <?php if(get_field('testlabel')): ?>
     
    	<ul>
     
    	<?php while(has_sub_field('testlabel')): ?>
     
    		<li><a href="<?php echo $url; ?>" class="wpaudio"><?php echo $title; ?></a></li>
     
    	<?php endwhile; ?>
     
    	</ul>
     
    <?php endif; ?>