Home › Forums › Bug Reports › File doesn't appear to work inside a repeater › Reply To: File doesn't appear to work inside a repeater
Ok, ok, in classic form you know how after a couple of hours of banging your head and then posting in support as a final cry for help you stumble across the obvious answer.
Well, here it is in case anyone else is lost.
You need to make sure “SUB” is added to the code like so:
<?php if( get_sub_field('file') ): ?>
<a href="<?php the_sub_field('file'); ?>" >Download File</a>
<?php endif; ?>
So add “get_sub_field” and “the_sub_field” and it will work. You need to add “sub” for repeaters and adjust the code inside accordingly.
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.