Created
July 26, 2018 13:13
-
-
Save raiden808/2ee2532e98af29f06ac538c1f625310f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// create custom plugin settings menu | |
add_action('admin_menu', 'rda_create_menu'); | |
function rda_create_menu() { | |
//create new top-level menu | |
add_menu_page('RDA Plugin Settings', 'RDA Settings', 'administrator', __FILE__, 'rda_settings_page' | |
,'dashicons-carrot'); | |
//call register settings function | |
add_action( 'admin_init', 'register_mysettings' ); | |
} | |
function register_mysettings() { | |
//register our settings | |
register_setting( 'rda-settings-group', 'new_option_name' ); | |
register_setting( 'rda-settings-group', 'some_other_option' ); | |
} | |
function rda_settings_page() { | |
?> | |
<div class="wrap"> | |
<h2>RDA SETTINGS</h2> | |
<form method="post" action="options.php"> | |
<?php settings_fields( 'rda-settings-group' ); ?> | |
<table class="form-table"> | |
<tr valign="top"> | |
<th scope="row">New Option Name</th> | |
<td><input type="text" name="new_option_name" value="<?php echo get_option('new_option_name'); ?>" /></td> | |
</tr> | |
<tr valign="top"> | |
<th scope="row">Some Other Option</th> | |
<td><input type="text" name="some_other_option" value="<?php echo get_option('some_other_option'); ?>" /></td> | |
</tr> | |
</table> | |
<p class="submit"> | |
<input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" /> | |
</p> | |
</form> | |
</div> | |
<?php } ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment