Home › Forums › Add-ons › Repeater Field › Display Title of File in href using Repeater › Reply To: Display Title of File in href using Repeater
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.
<?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; ?>
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!
🚀 This week’s session of ACF Chat Fridays dips into the preliminary results of our first ever user survey. Don’t miss it! https://t.co/3UtvQbDwNm pic.twitter.com/kMwhaJTkZc— Advanced Custom Fields (@wp_acf) May 9, 2023
© 2023 Advanced Custom Fields.