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)

The topic ‘Display all the values from a Radio Button field’ is closed to new replies.