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:

    $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.