Home › Forums › General Issues › Output Select label, based on page parent ID › Reply To: Output Select label, based on page parent ID
Thanks for this.
I’m still outputting nothing for the label though. With this block of code, I can happily output the $color_scheme_parent variable, which is the value set from the select list, but not the label:
<?php
/*
* Displaying a single value's Label
*/
$field = get_field_object('color');
$value = get_field('color_scheme_color');
$label = $field['choices'][ $value ];
?>
<p>Color label: <?php echo $label; ?> Parent color: <?php echo $color_scheme_parent; ?></p>
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.