Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@remcotolsma
Created June 29, 2014 10:35
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 remcotolsma/e89303a67e9fe821cbd1 to your computer and use it in GitHub Desktop.
Save remcotolsma/e89303a67e9fe821cbd1 to your computer and use it in GitHub Desktop.
<?php
function orbis_timesheets_admin_menu() {
add_menu_page(
__( 'Orbis Timesheets', 'orbis_timesheets' ),
__( 'Timesheets', 'orbis_timesheets' ),
'manage_options',
'orbis_timesheets',
'__return_false',
'dashicons-clock',
40
);
add_submenu_page(
'orbis_timesheets', // parent_slug
__( 'Orbis Timesheets Settings', 'orbis_timesheets' ), // page_title
__( 'Settings', 'orbis_timesheets' ), // menu_title
'manage_options', // capability
'orbis_timesheets_settings', // menu_slug
'__return_false' // function
);
global $submenu;
/*
* Add taxonomy 'orbis_timesheets_activity' to sub menu
* @see https://github.com/WordPress/WordPress/blob/3.9.1/wp-admin/menu.php#L59
*/
if ( isset( $submenu['orbis_timesheets'] ) ) {
$tax = get_taxonomy( 'orbis_timesheets_activity' );
$submenu['orbis_timesheets'][] = array(
esc_attr( $tax->labels->menu_name ),
$tax->cap->manage_terms,
add_query_arg( 'taxonomy', $tax->name, 'edit-tags.php' )
);
}
}
add_action( 'admin_menu', 'orbis_timesheets_admin_menu' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment