I'm working on a WordPress settings page that has a radio button with 2 given options 'yes' or 'no' but it doesn't seem to retain the chosen option, it deselects after a refresh. It's of great importance that the chosen option stays selected because it triggers the display of an element. I've researched and experimented with the PHP function below but it still doesn't retain the chosen option.
function section_footer() {}
add_settings_field('socialbar', 'Display Social Bar', 'socialbar', __FILE__, 'footer_settings' );
}
function socialbar() {
$options = get_option('theme_options'); echo "<input name='theme_options[socialbar]' type='radio' value='yes' />"; echo 'Yes'; echo " ";
if (isset($socialbar) && $socialbar=="yes") echo "checked";
$options = get_option('theme_options'); echo "<input name='theme_options[socialbar]' type='radio' value='no' />"; echo 'No';
if (isset($socialbar) && $socialbar=="no") echo "checked";
}