<?php
add_action( 'admin_init', 'theme_options_init' );
add_action( 'admin_menu', 'theme_options_add_page' );

function theme_options_init(){
	register_setting( 'sample_options', 'sample_theme_options', 'theme_options_validate' );
}

function theme_options_add_page() {
	add_theme_page( __( 'Theme Options', 'bodyhealth' ), __( 'Theme Options', 'bodyhealth' ), 'edit_theme_options', 'theme_options', 'theme_options_do_page' );
}

function theme_options_do_page() {
	

	if ( ! isset( $_REQUEST['settings-updated'] ) )
		$_REQUEST['settings-updated'] = false;

	?>
	<div class="wrap">
		<?php screen_icon(); echo "<h2>" .wp_get_theme(). __( ' Theme Options', 'bodyhealth' ) . "</h2>"; ?>

		<?php if ( false !== $_REQUEST['settings-updated'] ) : ?>
		<div class="updated fade"><p><strong><?php _e( 'Options saved', 'bodyhealth' ); ?></strong></p></div>
		<?php endif; ?>
		
		
		<form method="post" action="options.php">
			<?php settings_fields( 'sample_options' ); ?>
			<?php $options = get_option( 'sample_theme_options' ); ?>
		
			<h3> Header Setting </h3>
			<table class="form-table">
				<tr valign="top"><th scope="row"><?php _e( 'Phone No', 'bodyhealth' ); ?></th>
					<td>
						<input id="sample_theme_options[phone]" class="regular-text" type="text" name="sample_theme_options[phone]" value="<?php esc_attr( $options['phone'] ); ?>" />
						<label class="description" for="sample_theme_options[phone]"><?php _e( '+91 (129) 000-0000 ', 'bodyhealth' ); ?></label>
					</td>
				</tr>
					<tr valign="top"><th scope="row"><?php _e( 'Logo', 'bodyhealth' ); ?></th>
					<td>
						<input id="sample_theme_options[logo]" class="regular-text" type="text" name="sample_theme_options[logo]" value="<?php esc_attr( $options['logo'] ); ?>" />
						<label class="description" for="sample_theme_options[logo]"><?php _e( 'http://localhost/bodyhealth/wp-content/uploads/2013/10/logo-one.png', 'bodyhealth' ); ?></label>
					</td>
				</tr>
				
				<tr valign="top"><th scope="row"><?php _e( 'Twitter', 'bodyhealth' ); ?></th>
					<td>
						<input id="sample_theme_options[twitter]" class="regular-text" type="text" name="sample_theme_options[twitter]" value="<?php esc_attr( $options['twitter'] ); ?>" />
						<label class="description" for="sample_theme_options[twitter]"><?php _e( 'twitter link', 'bodyhealth' ); ?></label>
					</td>
			</tr>
			<tr valign="top"><th scope="row"><?php _e( 'Facebook', 'bodyhealth' ); ?></th>
					<td>
						<input id="sample_theme_options[facebook]" class="regular-text" type="text" name="sample_theme_options[facebook]" value="<?php esc_attr( $options['facebook'] ); ?>" />
						<label class="description" for="sample_theme_options[facebook]"><?php _e( 'facebook link', 'bodyhealth' ); ?></label>
					</td>
			</tr>
			<tr valign="top"><th scope="row"><?php _e( 'Google+', 'bodyhealth' ); ?></th>
					<td>
						<input id="sample_theme_options[googleplus]" class="regular-text" type="text" name="sample_theme_options[googleplus]" value="<?php esc_attr( $options['googleplus'] ); ?>" />
						<label class="description" for="sample_theme_options[googleplus]"><?php _e( 'Google+ link', 'bodyhealth' ); ?></label>
					</td>
			</tr>
			<tr valign="top"><th scope="row"><?php _e( 'Linkedin', 'bodyhealth' ); ?></th>
					<td>
						<input id="sample_theme_options[linkedin]" class="regular-text" type="text" name="sample_theme_options[linkedin]" value="<?php esc_attr( $options['linkedin'] ); ?>" />
						<label class="description" for="sample_theme_options[linkedin]"><?php _e( 'Linkedin link', 'bodyhealth' ); ?></label>
					</td>
			</tr>
			
			
			</table>
			
			<h3>Home page silder</h3>
			
			<table class="form-table">
				<tr valign="top"><th scope="row"><?php _e( 'Silde 1', 'bodyhealth' ); ?></th>
					<td>
						<input id="sample_theme_options[silde1]" class="regular-text" type="text" name="sample_theme_options[silde1]" value="<?php esc_attr( $options['silde1'] ); ?>" />
						<label class="description" for="sample_theme_options[silde1]"><?php _e( 'http://localhost/bodyhealth/wp-content/uploads/2013/10/logo-one.png ', 'bodyhealth' ); ?></label>
					</td>
				</tr>
				
				<tr valign="top"><th scope="row"><?php _e( 'Title', 'bodyhealth' ); ?></th>
					<td>
						<input id="sample_theme_options[title]" class="regular-text" type="text" name="sample_theme_options[title]" value="<?php esc_attr( $options['title'] ); ?>" />
						<label class="description" for="sample_theme_options[title]"></label>
					</td>
				</tr>
				
				<tr valign="top"><th scope="row"><?php _e( 'Content', 'bodyhealth' ); ?></th>
					<td>
						<input id="sample_theme_options[content]" class="regular-text" type="text" name="sample_theme_options[content]" value="<?php esc_attr( $options['content'] ); ?>" />
						<label class="description" for="sample_theme_options[content]"></label>
					</td>
				</tr>

					
					<tr valign="top"><th scope="row"><?php _e( 'Silde 2', 'bodyhealth' ); ?></th>
					<td>
						<input id="sample_theme_options[silde2]" class="regular-text" type="text" name="sample_theme_options[silde2]" value="<?php esc_attr( $options['silde2'] ); ?>" />
						<label class="description" for="sample_theme_options[silde2]"><?php _e( 'http://localhost/bodyhealth/wp-content/uploads/2013/10/logo-one.png', 'bodyhealth' ); ?></label>
					</td>
				</tr>
				
				<tr valign="top"><th scope="row"><?php _e( 'Title', 'bodyhealth' ); ?></th>
					<td>
						<input id="sample_theme_options[title1]" class="regular-text" type="text" name="sample_theme_options[title1]" value="<?php esc_attr( $options['title1'] ); ?>" />
						<label class="description" for="sample_theme_options[title1]"></label>
					</td>
				</tr>
				
				<tr valign="top"><th scope="row"><?php _e( 'Content', 'bodyhealth' ); ?></th>
					<td>
						<input id="sample_theme_options[content1]" class="regular-text" type="text" name="sample_theme_options[content1]" value="<?php esc_attr( $options['content1'] ); ?>" />
						<label class="description" for="sample_theme_options[content1]"></label>
					</td>
				</tr>
				
				<tr valign="top"><th scope="row"><?php _e( 'Silde 3', 'bodyhealth' ); ?></th>
					<td>
						<input id="sample_theme_options[silde3]" class="regular-text" type="text" name="sample_theme_options[silde3]" value="<?php esc_attr( $options['silde3'] ); ?>" />
						<label class="description" for="sample_theme_options[silde3]"><?php _e( 'http://localhost/bodyhealth/wp-content/uploads/2013/10/logo-one.png', 'bodyhealth' ); ?></label>
					</td>
			</tr>
			
			<tr valign="top"><th scope="row"><?php _e( 'Title', 'bodyhealth' ); ?></th>
					<td>
						<input id="sample_theme_options[title2]" class="regular-text" type="text" name="sample_theme_options[title2]" value="<?php esc_attr( $options['title2'] ); ?>" />
						<label class="description" for="sample_theme_options[title2]"></label>
					</td>
				</tr>
				
				<tr valign="top"><th scope="row"><?php _e( 'Content', 'bodyhealth' ); ?></th>
					<td>
						<input id="sample_theme_options[content2]" class="regular-text" type="text" name="sample_theme_options[content2]" value="<?php esc_attr( $options['content2'] ); ?>" />
						<label class="description" for="sample_theme_options[content2]"></label>
					</td>
				</tr>
			<tr valign="top"><th scope="row"><?php _e( 'Silde 4', 'bodyhealth' ); ?></th>
					<td>
						<input id="sample_theme_options[silde4]" class="regular-text" type="text" name="sample_theme_options[silde4]" value="<?php esc_attr( $options['silde4'] ); ?>" />
						<label class="description" for="sample_theme_options[silde4]"><?php _e( 'http://localhost/bodyhealth/wp-content/uploads/2013/10/logo-one.png', 'bodyhealth' ); ?></label>
					</td>
			</tr>
			
			<tr valign="top"><th scope="row"><?php _e( 'Title', 'bodyhealth' ); ?></th>
					<td>
						<input id="sample_theme_options[title3]" class="regular-text" type="text" name="sample_theme_options[title3]" value="<?php esc_attr( $options['title3'] ); ?>" />
						<label class="description" for="sample_theme_options[title3]"></label>
					</td>
				</tr>
				
				<tr valign="top"><th scope="row"><?php _e( 'Content', 'bodyhealth' ); ?></th>
					<td>
						<input id="sample_theme_options[content3]" class="regular-text" type="text" name="sample_theme_options[content3]" value="<?php esc_attr( $options['content3'] ); ?>" />
						<label class="description" for="sample_theme_options[content3]"></label>
					</td>
				</tr>
			
			</table>
			
			<h3> Box Area </h3>
			
			<table class="form-table">
				<tr valign="top"><th scope="row"><?php _e( 'Image', 'bodyhealth' ); ?></th>
					<td>
						<input id="sample_theme_options[img]" class="regular-text" type="text" name="sample_theme_options[img]" value="<?php esc_attr( $options['img'] ); ?>" />
						<label class="description" for="sample_theme_options[img]"><?php _e( 'http://localhost/bodyhealth/wp-content/uploads/2013/10/logo-one.png ', 'bodyhealth' ); ?></label>
					</td>
				</tr>
				
				<tr valign="top"><th scope="row"><?php _e( 'Title', 'bodyhealth' ); ?></th>
					<td>
						<input id="sample_theme_options[box-title]" class="regular-text" type="text" name="sample_theme_options[box-title]" value="<?php esc_attr( $options['box-title'] ); ?>" />
						<label class="description" for="sample_theme_options[box-title]"></label>
					</td>
				</tr>
				
				<tr valign="top"><th scope="row"><?php _e( 'Content', 'bodyhealth' ); ?></th>
					<td>
						<input id="sample_theme_options[box-content]" class="regular-text" type="text" name="sample_theme_options[box-content]" value="<?php esc_attr( $options['box-content'] ); ?>" />
						<label class="description" for="sample_theme_options[box-content]"></label>
					</td>
				</tr>

					
					<tr valign="top"><th scope="row"><?php _e( 'Image', 'bodyhealth' ); ?></th>
					<td>
						<input id="sample_theme_options[img1]" class="regular-text" type="text" name="sample_theme_options[img1]" value="<?php esc_attr( $options['img1'] ); ?>" />
						<label class="description" for="sample_theme_options[img1]"><?php _e( 'http://localhost/bodyhealth/wp-content/uploads/2013/10/logo-one.png', 'bodyhealth' ); ?></label>
					</td>
				</tr>
				
				<tr valign="top"><th scope="row"><?php _e( 'Title', 'bodyhealth' ); ?></th>
					<td>
						<input id="sample_theme_options[box-title1]" class="regular-text" type="text" name="sample_theme_options[box-title1]" value="<?php esc_attr( $options['box-title1'] ); ?>" />
						<label class="description" for="sample_theme_options[box-title1]"></label>
					</td>
				</tr>
				
				<tr valign="top"><th scope="row"><?php _e( 'Content', 'bodyhealth' ); ?></th>
					<td>
						<input id="sample_theme_options[box-content1]" class="regular-text" type="text" name="sample_theme_options[box-content1]" value="<?php esc_attr( $options['box-content1'] ); ?>" />
						<label class="description" for="sample_theme_options[box-content1]"></label>
					</td>
				</tr>
				
				<tr valign="top"><th scope="row"><?php _e( 'Image', 'bodyhealth' ); ?></th>
					<td>
						<input id="sample_theme_options[img2]" class="regular-text" type="text" name="sample_theme_options[img2]" value="<?php esc_attr( $options['img2'] ); ?>" />
						<label class="description" for="sample_theme_options[img2]"><?php _e( 'http://localhost/bodyhealth/wp-content/uploads/2013/10/logo-one.png', 'bodyhealth' ); ?></label>
					</td>
			</tr>
			
			<tr valign="top"><th scope="row"><?php _e( 'Title', 'bodyhealth' ); ?></th>
					<td>
						<input id="sample_theme_options[box-title2]" class="regular-text" type="text" name="sample_theme_options[box-title2]" value="<?php esc_attr( $options['box-title2'] ); ?>" />
						<label class="description" for="sample_theme_options[box-title2]"></label>
					</td>
				</tr>
				
				<tr valign="top"><th scope="row"><?php _e( 'Content', 'bodyhealth' ); ?></th>
					<td>
						<input id="sample_theme_options[box-content2]" class="regular-text" type="text" name="sample_theme_options[box-content2]" value="<?php esc_attr( $options['box-content2'] ); ?>" />
						<label class="description" for="sample_theme_options[box-content2]"></label>
					</td>
				</tr>
			
			
			</table>
			
			<h3>Put a category </h3>
			<table class="form-table">
				<tr valign="top"><th scope="row"><?php _e( 'Category', 'bodyhealth' ); ?></th>
					<td>
						
						<input id="sample_theme_options[cat]" class="regular-text" type="text" name="sample_theme_options[cat]" value="<?php esc_attr( $options['cat'] ); ?>" />
						<label class="description" for="sample_theme_options[cat]"></label>
					</td>
				</tr>
				
				<tr valign="top"><th scope="row"><?php _e( 'Category', 'bodyhealth' ); ?></th>
					<td>
						
						<input id="sample_theme_options[cat1]" class="regular-text" type="text" name="sample_theme_options[cat1]" value="<?php esc_attr( $options['cat1'] ); ?>" />
						<label class="description" for="sample_theme_options[cat1]"></label>
					</td>
				</tr>
				
				<tr valign="top"><th scope="row"><?php _e( 'Address', 'bodyhealth' ); ?></th>
					<td>
						
						<input id="sample_theme_options[add]" class="regular-text" type="text" name="sample_theme_options[add]" value="<?php esc_attr( $options['add'] ); ?>" />
						<label class="description" for="sample_theme_options[add]"></label>
					</td>
				</tr>
			</table>
		
			<p class="submit">
				<input type="submit" class="button-primary" value="<?php _e( 'Save Options', 'bodyhealth' ); ?>" />
			</p>
		
		</form>
		
		
<?php
}

function theme_options_validate( $input ) {
	global $select_options, $radio_options;
	
	
	$input['phone'] = wp_filter_nohtml_kses( $input['phone'] );
	$input['logo'] = wp_filter_nohtml_kses( $input['logo'] );
	$input['twitter'] = wp_filter_nohtml_kses( $input['twitter'] );
	$input['facebook'] = wp_filter_nohtml_kses( $input['facebook'] );
	$input['googleplus'] = wp_filter_nohtml_kses( $input['googleplus'] );
	$input['linkedin'] = wp_filter_nohtml_kses( $input['linkedin'] );
	$input['silde1'] = wp_filter_nohtml_kses( $input['silde1'] );
	$input['title'] = wp_filter_nohtml_kses( $input['title'] );
	$input['content'] = wp_filter_nohtml_kses( $input['content'] );
	$input['silde2'] = wp_filter_nohtml_kses( $input['silde2'] );
	$input['title1'] = wp_filter_nohtml_kses( $input['title1'] );
	$input['content1'] = wp_filter_nohtml_kses( $input['content1'] );
	$input['silde3'] = wp_filter_nohtml_kses( $input['silde3'] );
	$input['title2'] = wp_filter_nohtml_kses( $input['title2'] );
	$input['content2'] = wp_filter_nohtml_kses( $input['content2'] );
	$input['silde4'] = wp_filter_nohtml_kses( $input['silde4'] );
	$input['title3'] = wp_filter_nohtml_kses( $input['title3'] );
	$input['content3'] = wp_filter_nohtml_kses( $input['content3'] );
	
	$input['img'] = wp_filter_nohtml_kses( $input['img'] );
	$input['box-title'] = wp_filter_nohtml_kses( $input['box-title'] );
	$input['box-content'] = wp_filter_nohtml_kses( $input['box-content'] );
	$input['img1'] = wp_filter_nohtml_kses( $input['img1'] );
	$input['box-title1'] = wp_filter_nohtml_kses( $input['box-title1'] );
	$input['box-content1'] = wp_filter_nohtml_kses( $input['box-content1'] );
	$input['img2'] = wp_filter_nohtml_kses( $input['img2'] );
	$input['box-title2'] = wp_filter_nohtml_kses( $input['box-title2'] );
	$input['box-content2'] = wp_filter_nohtml_kses( $input['box-content2'] );
	$input['box-content2'] = wp_filter_nohtml_kses( $input['box-content2'] );
	$input['cat'] = wp_filter_nohtml_kses( $input['cat'] );
	$input['cat1'] = wp_filter_nohtml_kses( $input['cat1'] );
	$input['add'] = wp_filter_nohtml_kses( $input['add'] );
	
	
	return $input;
	
}