I have to create a option page in my custom theme wordpress. here is is a sample of code
<?php
function bguru_register_settings(){
$default_options=array(
'bguru_logo'=>'http://templategraphy.com/demo/businessguru/images/logo.png',
'bguru_vimeo'=>'',
'bguru_skype'=>'',
'bguru_dribbble'=>'',
'bguru_slide_one_image'=>'',
'bguru_slide_one_heading'=>'',
'bguru_slide_one_text'=>''
);
add_option('bguru_options',$default_options);
register_setting('tgbusinessguru', 'bguru_options');
}
add_action('admin_init', 'bguru_register_settings');
function bguru_register_options_page(){
add_theme_page('Business Guru Options', 'Theme Customizer', 'edit_theme_options', 'bguru-options', 'bguru_options_page');
}
add_action('admin_menu', 'bguru_register_options_page');
function bguru_options_page(){
$options=get_option('bguru_options');
?>
<div class="wrap">
<?php
screen_icon(); ?>
<h1>Business Guru Options</h1>
<form method="post" action="options.php">
<?php
settings_fields('tgbusinessguru'); ?>
<table class="form-table">
<tr valign="top">
<th><h2>General</h2><th>
</tr>
<tr valign="top">
<th scope="row"><label for="bguru_logo">Logo:</label></th>
<td><input type="text" id="bguru_logo" size="50" name="bguru_options[bguru_logo]" value="<?php echo $options['bguru_logo']; ?>" /></td>
</tr>
<tr valign="top">
<th><h2>Social Links</h2><th>
</tr>
<tr valign="top">
<th scope="row"><label for="bguru_vimeo">Vimeo:</label></th>
<td><input type="text" id="bguru_vimeo" size="50" name="bguru_options[bguru_vimeo]" value="<?php echo $options['bguru_vimeo']; ?>" /></td>
</tr>
<tr valign="top">
<th scope="row"><label for="bguru_skype">Skype:</label></th>
<td><input type="text" id="bguru_skype" size="50" name="bguru_options[bguru_skype]" value="<?php echo $options['bguru_skype']; ?>" /></td>
</tr>
<tr valign="top">
<th scope="row"><label for="bguru_dribbble">Dribbble:</label></th>
<td><input type="text" id="bguru_dribbble" size="50" name="bguru_options[bguru_dribbble]" value="<?php echo $options['bguru_dribbble']; ?>" /></td>
</tr>
<tr valign="top">
<th scope="row"><label for="bguru_slide_one_image">Image:</label></th>
<td><input type="text" id="bguru_slide_one_image" size="50" name="bguru_options[bguru_slide_one_image]" value="<?php
echo $options['bguru_slide_one_image']; ?>" /></td>
</tr>
<tr valign="top">
<th scope="row"><label for="bguru_slide_one_heading">Heading:</label></th>
<td><input type="text" id="bguru_slide_one_heading" size="50" name="bguru_options[bguru_slide_one_heading]" value="<?php
echo $options['bguru_slide_one_heading']; ?>" /></td>
</tr>
<tr valign="top">
<th scope="row"><label for="bguru_slide_one_text">Description:</label></th>
<td><textarea type="text" id="bguru_slide_one_text" style="width:439px;height:100px;" name="bguru_options[bguru_slide_one_text]"><?php echo $options['bguru_slide_one_text']; ?></textarea></td>
</tr>
</table>
<?php submit_button(); ?>
</form>
</div>
<?php } ?>
All the form details are passed by dashboard I want if admin forget to fill the logo field then by default this $default_options work so by default logo field fill up but when I try to access the array using get_option I'm not getting the results I expect.