Using this method you can create a simple theme option panel. This code using wordpress inbuild api function to create theme option panel
<?php
// create custom plugin settings menu
add_action(‘admin_menu’, ‘my_cool_plugin_create_menu’);function my_cool_plugin_create_menu() {
//create new top-level menu
add_menu_page(‘Google Ad’, ‘Google Ad Settings’, ‘administrator’, __FILE__, ‘my_cool_plugin_settings_page’ , ‘dashicons-screenoptions’, __FILE__) );//call register settings function
add_action( ‘admin_init’, ‘register_my_cool_plugin_settings’ );
}
function register_my_cool_plugin_settings() {
//register our settings
register_setting( ‘my-cool-plugin-settings-group’, ‘core_google_ad’ );}
function my_cool_plugin_settings_page() {
?>
<div class=”wrap”>
<h1>Google Ad Settings</h1><form method=”post” action=”options.php”>
<?php settings_fields( ‘my-cool-plugin-settings-group’ ); ?>
<?php do_settings_sections( ‘my-cool-plugin-settings-group’ ); ?>
<table class=”form-table”>
<tr valign=”top”>
<th scope=”row”>Enter Advertisment Code</th>
<td>
<textarea name=”core_google_ad”>
<?php echo esc_attr( get_option(‘core_google_ad’) ); ?>
</textarea>
</td>
<small> You can enter any advertisment code here </small>
</tr></table>
<?php submit_button(); ?>
</form>
</div>
<?php } ?>