Skip to content

Radio buttons

One choice from a short list, with every option visible, such as the position of the logo.

In the editor

Radio buttons in the editor, with three field values: Left, Center and Right

Besides the settings every field shares, radio buttons have:

Setting What it does
Field values The choices. Every row has a value (what is stored) and a label (what you see on the options page). Move the rows up or down with the arrows to change their order.

On the options page

The radio buttons on the options page, with Left chosen

As long as nothing is saved, the first choice is selected.

The value

Stores the value of the chosen row, not its label. A value that is not in the list becomes empty.

On your website

The shortcode and blocks show the stored value. When the value is no longer one of the choices, they show nothing.

$position = get_option( 'logo_position', 'left' );

echo '<header class="logo-' . esc_attr( $position ) . '">';