Hello,
I have the basic ACF plugin and I can’t display the select choice of a dropdown.
No problem with displaying text fields with get_fields, for instance : <?php echo get_field(‘titre_vo’); ?>
but when I try it with a select choice nothing appears.
I’m really a newbie, so I’m sorry if my question has alredy been covered, I tried a lot of things but nothings works, at best it display “empty” or “array” when I try something other than get_field.
Thanks a lot for your assistance!
Hi @daisuke
Are you returning a single or multiple value?
As per the docs
If it’s a single value, use:
<p>Color: <?php the_field('color'); ?></p>
If it’s a multiple value, use:
<?php
$colors = get_field( 'color' );
// Create a comma-separated list from selected values.
if( $colors ): ?>
<p>Color: <?php echo implode( ', ', $colors ); ?></p>
<?php endif; ?>
Change color to the name of you ACF field, see if that works.
Hi Jarvis,
Thank you for taking the time to answer my question.
The support helped me too, it was because of a name conflict…
Have a nice day!