Fix bugs, use plural post slugs, move actions and filters into hooks folder

This commit is contained in:
Brian Miyaji
2014-01-09 02:37:13 +11:00
parent e76d392726
commit bfcf6e9b38
32 changed files with 390 additions and 312 deletions

View File

@@ -0,0 +1,39 @@
<?php
function sportspress_admin_menu( $position ) {
add_options_page(
__( 'SportsPress', 'sportspress' ),
__( 'SportsPress', 'sportspress' ),
'manage_options',
'sportspress',
'sportspress_settings'
);
if ( ! current_user_can( 'manage_options' ) )
return;
global $menu, $submenu;
// Find where our placeholder is in the menu
foreach( $menu as $key => $data ) {
if ( is_array( $data ) && array_key_exists( 2, $data ) && $data[2] == 'edit.php?post_type=sp_separator' )
$position = $key;
}
// Swap our placeholder post type with a menu separator
if ( $position ):
$menu[ $position ] = array( '', 'read', 'separator-sportspress', '', 'wp-menu-separator sportspress' );
endif;
// Remove "Add Configuration" link under SportsPress
unset( $submenu['edit.php?post_type=sp_config'][10] );
// Remove "Seasons" link under Events
unset( $submenu['edit.php?post_type=sp_event'][15] );
// Remove "Seasons" link under Players
unset( $submenu['edit.php?post_type=sp_player'][15] );
// Remove "Seasons" link under Staff
unset( $submenu['edit.php?post_type=sp_staff'][15] );
}
add_action( 'admin_menu', 'sportspress_admin_menu' );