Skip to content

Instantly share code, notes, and snippets.

@kovalenko-anton
Last active June 15, 2017 08:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kovalenko-anton/0d276fcf729e32e026efc33fc1594df6 to your computer and use it in GitHub Desktop.
Save kovalenko-anton/0d276fcf729e32e026efc33fc1594df6 to your computer and use it in GitHub Desktop.
add_action( 'admin_menu', function(){
add_menu_page( 'Empty Page', // The text to be displayed in the title tags of the page when the menu is selected.
'New Page', // The text to be used for the menu.
'manage_options', // The capability required for this menu to be displayed to the user.
'site-options', // The slug name to refer to this menu by (should be unique for this menu).
'add_my_setting', // The function to be called to output the content for this page.
'', // The URL to the icon to be used for this menu.
4 ); // The position in the menu order this one should appear.
register_setting( 'new-settings-group', 'new_setting' );
} );
// The function to be called to output the content for this page.
function add_my_setting(){
?>
<div class="wrap">
<h2><?php echo get_admin_page_title() ?></h2>
</div>
<form method="post" action="options.php">
<div class="input_wrap">
<label for="new_setting">new_setting name</label>
<input id="new_setting" type="text" name="new_setting" value="<?php echo get_option('new_setting'); ?>" />
</div>
<?php settings_fields( 'new-settings-group' );?>
<?php submit_button(); ?>
</form>
<?php
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment