Skip to content

Instantly share code, notes, and snippets.

@wpcrmsystem
Created August 30, 2016 20:49
Show Gist options
  • Save wpcrmsystem/69e2285cf5e4cb77d50187e5febc9704 to your computer and use it in GitHub Desktop.
Save wpcrmsystem/69e2285cf5e4cb77d50187e5febc9704 to your computer and use it in GitHub Desktop.
Add custom settings page
<?php
// Add a tab to the dashboard page
function wpcrm_system_custom_setting_tab() {
//Get current dashboard tab name
global $wpcrm_active_tab;
//Be sure that 'my-tab-name' is the same in both places! ?>
<a class="nav-tab <?php echo $wpcrm_active_tab == 'my-tab-name' ? 'nav-tab-active' : ''; ?>" href="?page=wpcrm-settings&tab=my-tab-name"><?php _e('My Tab Name', 'wp-crm-system') ?></a>
<?php }
add_action( 'wpcrm_system_settings_tab', 'wpcrm_system_custom_setting_tab' );
function wpcrm_custom_settings_content() {
//Get current dashboard tab name
global $wpcrm_active_tab;
if ($wpcrm_active_tab == 'my-tab-name') {
// include your plugin's settings content here
}
}
add_action( 'wpcrm_system_settings_content', 'wpcrm_custom_settings_content' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment