Skip to content

Instantly share code, notes, and snippets.

@SpencerCooley
Created August 26, 2012 03:28
Show Gist options
  • Select an option

  • Save SpencerCooley/3473564 to your computer and use it in GitHub Desktop.

Select an option

Save SpencerCooley/3473564 to your computer and use it in GitHub Desktop.
add a settings section to a wordpress theme.
<?php
/* This is the custom extra theme option panel.*/
//Custom Theme Settings
add_action('admin_menu', 'add_gcf_interface');
function add_gcf_interface() {
add_options_page('Extra Theme Settings', 'Extra Theme Settings', '8', 'functions', 'editglobalcustomfields');
}
function editglobalcustomfields() {
?>
<div class='wrap'>
<h2>Extra Theme Options</h2>
<form method="post" action="options.php">
<?php wp_nonce_field('update-options') ?>
<p><strong>Navigation Padding (full screen):</strong><br />
<input type="text" name="padding_menu_full_width" size="2" value="<?php echo get_option('padding_menu_full_width'); ?>" /> px</p>
<p><strong>Navigation Padding (First Shrink):</strong><br />
<input type="text" name="padding_menu_second_width" size="2" value="<?php echo get_option('padding_menu_second_width'); ?>" /> px</p>
<p><input type="submit" name="Submit" value="Update Options" /></p>
<input type="hidden" name="action" value="update" />
<input type="hidden" name="page_options" value="padding_menu_full_width,padding_menu_second_width" />
</form>
</div>
<?php
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment