Home › Forums › Front-end Issues › Trying to add conditional display to blog-list › Reply To: Trying to add conditional display to blog-list
ok, trying again. This doesn’t display empty buttons… but seems to not display anything at all.
$buttons = get_fields();
if( $buttons ) {
echo
'<div class="et_pb_button_module_wrapper et_pb_button_3_tb_body_wrapper">';
foreach( $buttons as $but_name => $but_value ) {
if( !empty( $but_value ) ) {
$but_label = get_field_object($but_name);
echo
'<a class="vendor-link" title="',$but_label['label'] ,'" href="', $but_value ,'">', $but_label['label'] ,'</a>';
}
}
echo
'</div>';
}
Am I missing something obvious?
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.