Support

Account

Home Forums Front-end Issues Display all the values from a Radio Button field

Solved

Display all the values from a Radio Button field

  • Hi, is there a way to display all the options of a radio button field on the front end without referring to a post but just listing all the options?.

  • I found the answer on the documentation.

    <?php $field_key = "field_52b2c7c6bc3e5";
    									$field = get_field_object($field_key);
    	 
    if( $field ){
    	echo '<select name="' . $field['key'] . '">';
    	foreach( $field['choices'] as $k => $v ){
    	echo '<option value="' . $k . '">' . $v . '</option>';
    	}
    	echo '</select>';
    } ?>
Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.

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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.