Home › Forums › General Issues › acf if query problem › Reply To: acf if query problem
Impressive! I think that will get me much further.
but somewhere you have to have made a mistake.
maybe you forgot a quotation mark? (“) or too much?
what I have already managed is that the “color codes” are displayed. but only with “#”.
So not: #ffffff, just #
(but at least only as many as colors are available for the material)
my current code looks like this:
<?php
$colors = get_field('farben');
if( $colors ): ?>
<?php foreach( $colors as $color ): ?>
<div style="background-color:<?php echo $color['value']; ?>"><?php echo $color['label']; ?></div>
<?php endforeach; ?>
<?php endif; ?>
I would like to have the colors shown in small boxes.
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.