Home › Forums › Front-end Issues › Trying to add conditional display to blog-list › Reply To: Trying to add conditional display to blog-list
Ok, found the problem. I had to add the code in TWO placed within the theme template file….
This was my final working code – if anyone finds this in a future search
/* START position for Advanced Custom Fields Content -- aka vendor-links */
$buttons = get_fields();
if( $buttons ) {
echo
'<div class="button-strip 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-link3 ', $but_name ,'-button" title="',$but_label['label'] ,'" href="', $but_value ,'" target="_blank">', $but_label['label'] ,'</a>';
}
}
echo
'</div>';
}
/* FINISH position for Advanced Custom Fields Content -- aka vendor-links */
I then used some CSS on “vendor-link3” and the button name (like amazon-button) to style them as buttons.
Thanks for the pointers John.
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.