Radio
A list of radio buttons.
$options = [
'demo_radio' => [
'label' => __( 'Radio', 'unysonplus' ), // or false to hide the label column
'type' => 'radio',
'value' => 'c2',
'desc' => __( 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
'unysonplus' ),
'choices' => [
'c1' => __( 'Radio 1 Custom Text', 'unysonplus' ),
'c2' => __( 'Radio 2 Custom Text', 'unysonplus' ),
'c3' => __( 'Radio 3 Custom Text', 'unysonplus' ),
],
'help' => sprintf( "%s \n\n'\"<br/><br/>\n\n <b>%s</b>",
__( 'Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.',
'unysonplus' ),
__( 'Sed ut perspiciatis, unde omnis iste natus error sit voluptatem accusantium doloremque laudantium',
'unysonplus' )
),
// — Optional attributes you can add —
// 'inline' => false,
// 'attr' => [ 'class' => 'my-class', 'data-foo' => 'bar' ], // extra HTML attributes
],
];
Reading the value
radio returns a string — output it directly.
In a shortcode
The shortcode framework passes the option values into view.php as $atts:
echo esc_html( $atts['demo_radio'] );
In a page template — a per-page option
Options defined on a post/page (a metabox) are read with fw_get_db_post_option():
$value = fw_get_db_post_option( get_the_ID(), 'demo_radio' );
echo esc_html( $value );
When the field is one of several inside a box/group, read the whole group once and pick fields by key — the common CPT pattern (e.g. a review or book box):
$book = fw_get_db_post_option( get_the_ID(), 'book' );
echo esc_html( $book['demo_radio'] );
In Theme Settings — a global option
Global options are read with fw_get_db_settings_option():
$value = fw_get_db_settings_option( 'demo_radio' );
echo esc_html( $value );
Saved value
fw_print( fw_get_db_settings_option( 'demo_radio' ) ) outputs — the shape of this option type's stored value:
choice_2