Skip to content

Instantly share code, notes, and snippets.

@richgcook
Created February 24, 2014 11:20
Show Gist options
  • Save richgcook/9186654 to your computer and use it in GitHub Desktop.
Save richgcook/9186654 to your computer and use it in GitHub Desktop.
WP functions-xx.php init setup
// Remove specific menus from WP backend
function remove_menus () {
global $menu;
$restricted = array(__('Posts'),__('Comments'),__('Links'),__('Media')); // Can be whatever you want
end ($menu);
while ( prev($menu) ) {
$value = explode( ' ',$menu[key($menu)][0] );
if ( in_array($value[0] != NULL?$value[0]:"" , $restricted) ) {
unset( $menu[key($menu)] );
}
}
}
add_action('admin_menu', 'remove_menus');
// Remove WP login image
function change_my_wp_login_image() {
echo "
<style type='text/css'>
body.login #login h1 a {
display: none
}
</style>
";
}
add_action('login_head', 'change_my_wp_login_image');
// Remove admin bar, always
function fb_move_admin_bar() {
echo "
<style type='text/css'>
#adminmenu a.menu-top, #adminmenu .wp-submenu-head {
padding-right: 20px;
}
</style>
";
}
add_action( 'admin_head', 'fb_move_admin_bar' );
add_action( 'wp_head', 'fb_move_admin_bar' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment