Home › Forums › Add-ons › Repeater Field › 'if repeater field if empty else { …. }' doesn't work › Reply To: 'if repeater field if empty else { …. }' doesn't work
Hello zwaarcontrast,
Than you for your reply.
I tried similar code and worked.
I think the problem is when I check if the field ‘‘file’ is not empty to not show it in this case.
$link = get_sub_field(‘file’);
$name = get_sub_field(‘file_name’);
?>
<?php if( $link ): ?>
<a href=”<?php echo $link; ?>” target=”_blank”> <?php echo $name; ?>
<?php endif; ?>
</a>
Are you sure there are no downloads present?
Yes, I am.
When There is a attached file look like this:
and when there is not files look like this:
It’s strange because I don’t have any error in my error log also the debug of WP and my server is ON so.. I don’t know exactly what is the problem.
Thank you!
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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.