I finally got it! I think I wasn’t declaring my variables clearly enough.
$row = get_field( 'document' ); $first_row = $row; $first_row_file = $first_row[ 'file' ]; if( $first_row_file ) : $download = '<div>Available!<div>This document is ready for download.</div></div>' ; echo $download; else : $unavailable = '<div>Unavailable!<div>This document isn\'t ready yet. Please check back later.</div></div>' ; echo $unavailable; endif;
Now I can add more sophisticated content (like a download button) to display when there is a file to download, and a helpful message when there isn’t.
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!
© 2022 Advanced Custom Fields.