Making some custom options for a new theme, stuck on the layout_Style option, the default option (full) is not selected on the options page and changes are not being made when the option is changed.

Functions file:

Code:
<?php 

require_once ( get_stylesheet_directory() . '/theme-options.php' );

function sa_layout_view() {
	global $sa_options;
	$settings = get_option( 'sa_options', $sa_options );
	if( $settings['sidebar_position'] == 'right' ) : ?>
<style type="text/css">
	.widget-area {float:right; margin-right: 0;}
	.sidebar-content {margin-right: 20px;}
</style>
	<?php endif;
}
	function sa_layout_style() {
	global $sa_options;
	$settings = get_option( 'sa_options', $sa_options );
	if( $settings['layout_style'] == 'full' ) : ?>

<style type="text/css">
	
	body {background-color:transparent; overflow:hidden;}
	body .site {box-shadow:none;padding:0; margin-top: 0; margin-bottom: 0;}
	.vc_row-fluid {max-width:960px; margin:0 auto;}
	.row_full_width {width:100%;}
	
</style>
	
	<?php endif; }
	
add_action( 'wp_head', 'sa_layout_view', 'sa_layout_style' );

?>

Theme options file:

Code:
<?php

// Default options values
$sa_options = array(

	'sidebar_position' => 'left',
	'layout_style' => 'full',
	'author_credits' => true
);

if ( is_admin() ) : // Load only if we are viewing an admin page

function sa_register_settings() {
	// Register settings and call sanitation functions
	register_setting( 'sa_theme_options', 'sa_options', 'sa_validate_options' );
}

add_action( 'admin_init', 'sa_register_settings' );

// Store layouts views in array
$sa_layouts = array(
	'left' => array(
		'value' => 'left',
		'label' => 'left'
	),
	'right' => array(
		'value' => 'right',
		'label' => 'Right'
	),
);

$sa_layoutstyles = array(
	'full' => array(
		'value' => 'full',
		'label' => 'Full'
	),
	
	'boxed' => array(
		'value' => 'boxed',
		'label' => 'Boxed'
	),
);
	

function sa_theme_options() {
	// Add theme options page to the addmin menu
	add_theme_page( 'Theme Options', 'Theme Options', 'edit_theme_options', 'theme_options', 'sa_theme_options_page' );
}

add_action( 'admin_menu', 'sa_theme_options' );

// Function to generate options page
function sa_theme_options_page() {
	global $sa_options, $sa_layouts, $sa_layoutstyles;

	if ( ! isset( $_REQUEST['updated'] ) )
		$_REQUEST['updated'] = false; // This checks whether the form has just been submitted. ?>

	<div class="wrap">

	<?php screen_icon(); echo "<h2>" . get_current_theme() . __( ' Theme Options' ) . "</h2>";
	// This shows the page's name and an icon if one has been provided ?>

	<?php if ( false !== $_REQUEST['updated'] ) : ?>
	<div class="updated fade"><p><strong><?php _e( 'Options saved' ); ?></strong></p></div>
	<?php endif; // If the form has just been submitted, this shows the notification ?>

	<form method="post" action="options.php">

	<?php $settings = get_option( 'sa_options', $sa_options ); ?>
	
	<?php settings_fields( 'sa_theme_options' );
	/* This function outputs some hidden fields required by the form,
	including a nonce, a unique number used to ensure the form has been submitted from the admin page
	and not somewhere else, very important for security */ ?>

	<table class="form-table">

	<tr valign="top"><th scope="row">Sidebar Position</th>
	<td>
	<?php foreach( $sa_layouts as $layout ) : ?>
	<input type="radio" id="<?php echo $layout['value']; ?>" name="sa_options[sidebar_position]" value="<?php esc_attr_e( $layout['value'] ); ?>" <?php checked( $settings['sidebar_position'], $layout['value'] ); ?> />
	<label for="<?php echo $layout['value']; ?>"><?php echo $layout['label']; ?></label><br />
	<?php endforeach; ?>
	</td>
	</tr>
	
	<tr valign="top"><th scope="row">Layout Style</th>
	<td>
	<?php foreach( $sa_layoutstyles as $layoutstyle ) : ?>
	<input type="radio" id="<?php echo $layoutstyle['value']; ?>" name="sa_options[layout_style]" value="<?php esc_attr_e( $layoutstyle['value'] ); ?>" <?php checked( $settings['layout_style'], $layoutstyle['value'] ); ?> />
	<label for="<?php echo $layoutstyle['value']; ?>"><?php echo $layoutstyle['label']; ?></label><br />
	<?php endforeach; ?>
	</td>
	</tr>

	<tr valign="top"><th scope="row">Author Credits</th>
	<td>
	<input type="checkbox" id="author_credits" name="sa_options[author_credits]" value="1" <?php checked( true, $settings['author_credits'] ); ?> />
	<label for="author_credits">Show Author Credits</label>
	</td>
	</tr>

	</table>

	<p class="submit"><input type="submit" class="button-primary" value="Save Options" /></p>

	</form>

	</div>

	<?php
}

function sa_validate_options( $input ) {
	global $sa_options, $sa_layouts, $sa_layoutstyles;

	$settings = get_option( 'sa_options', $sa_options );
	
	// We select the previous value of the field, to restore it in case an invalid entry has been given
	$prev = $settings['sidebar_position'];
	// We verify if the given value exists in the layouts array
	if ( !array_key_exists( $input['sidebar_position'], $sa_layouts ) )
		$input['sidebar_position'] = $prev;
		
	$prev = $settings['layout_style'];
	
	if ( !array_key_exists( $input['layout_style'], $sa_layoutstyles ) )
		$input['layout_style'] = $prev;
	
	// If the checkbox has not been checked, we void it
	if ( ! isset( $input['author_credits'] ) )
		$input['author_credits'] = null;
	// We verify if the input is a boolean value
	$input['author_credits'] = ( $input['author_credits'] == 1 ? 1 : 0 );
	
	return $input;
}

endif;  // EndIf is_admin()
Theme files:

Code:
<?php 
	global $sa_options;
	$sa_settings = get_option( 'sa_options', $sa_options );

	if( $settings['layout_style'] == 'boxed' ) : ?>
		<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
	<?php endif; ?>
 
 <?php if( $settings['layout_style'] == 'full' ) : ?>
 </div></div></div>
		<div class="row_full_width">
 <?php endif; ?>