Home › Forums › General Issues › Outputting info from a 'File' field? › Reply To: Outputting info from a 'File' field?
Yes, it will work, but you should check the radio field first because it doesn’t make sense to get the values for the file unless you’re actually going to show them.
<?php
if (get_field('product_brochure') == 'yes') {
$file = get_field('product_brochure_pdf');
if ($file) {
?>
<a target="_blank" href="<?php
echo $file['url']; ?>" title="<?php
echo $file['title']; ?>"><?php
echo $file['title']; ?></a>
<?php
} // end if file
} // end if product_brochure
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.