Home › Forums › General Issues › acf if query problem › Reply To: acf if query problem
edit: I’ve got it, that the individual boxes of the colors are displayed. However, these are now empty …. do we have to work with an array here?
<?php
$colors = get_field('farben');
if( $colors ): ?>
<?php foreach( $colors as $color ): ?>
<div style="float: left; width: 10px; height: 10px; margin-right: 3px; border: 1px solid #000000; background-colo:-<?php echo $color['value']; ?>"></div>
<?php endforeach; ?>
<?php endif; ?>
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.