Forked from Bradley-D/WordPress: Minimize Dashboard
Last active
August 29, 2015 14:08
-
-
Save dsmy/4d94eee16d302e4c94fd to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// Custom Dashboard widgets | |
function custom_dashboard_widgets() { | |
global $wp_meta_boxes; | |
unset( $wp_meta_boxes['dashboard']['side']['core']['dashboard_quick_press'] ); | |
unset( $wp_meta_boxes['dashboard']['normal']['core']['dashboard_incoming_links'] ); | |
unset( $wp_meta_boxes['dashboard']['normal']['core']['dashboard_plugins'] ); | |
unset( $wp_meta_boxes['dashboard']['side']['core']['dashboard_primary'] ); | |
unset( $wp_meta_boxes['dashboard']['normal']['core']['dashboard_right_now'] ); | |
unset( $wp_meta_boxes['dashboard']['normal']['core']['dashboard_recent_comments'] ); | |
unset( $wp_meta_boxes['dashboard']['side']['core']['dashboard_recent_drafts'] ); | |
unset( $wp_meta_boxes['dashboard']['side']['core']['dashboard_secondary'] ); | |
// Intro Widget | |
function custom_dashboard_intro() { | |
echo '<p>Give your client a personal welcome message</p>'; | |
echo '<p>Put in your contact info, eg, email, phone, skype etc.</p>'; | |
} | |
// Media Widget | |
function custom_dashboard_media_info() { | |
echo '<p>Notes: Add details of image sizes here</p>'; | |
} | |
// Add the custom widget areas | |
wp_add_dashboard_widget( 'custom_intro_widget', 'Theme Support Intro', 'custom_dashboard_intro' ); | |
wp_add_dashboard_widget( 'custom_media_widgets', 'Theme Media Support', 'custom_dashboard_media_info' ); | |
} | |
add_action( 'wp_dashboard_setup', 'custom_dashboard_widgets' ); | |
// Add Dashboard Logo | |
function custom_admin_logo() { | |
echo '<style type="text/css">#header-logo { background-image: url(' . get_bloginfo('template_directory') . '/images/logo_admin_dashboard.png) !important; }</style>'; | |
} | |
add_action( 'admin_head', 'custom_admin_logo' ); | |
// Change Dashboard Footer Attribution | |
function remove_footer_admin() { | |
echo '<span id="footer-thankyou">Developed by <a href="http://www.designerswebsite.com" target="_blank">Name</a></span>'; | |
} | |
add_filter( 'admin_footer_text', 'remove_footer_admin' ); | |
// Remove Menu Items > Removes Tools and Users | |
function remove_menus() { | |
global $menu; | |
$restricted = array(__('Tools'),__('Users')); | |
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 Sub Menu Items > menu-ID:s are found in wp-admin/menu.php | |
function remove_submenus() { | |
global $submenu; | |
unset( $submenu['themes.php'][5] ); // Removes 'Themes'. | |
} | |
add_action( 'admin_menu', 'remove_submenus' ); | |
// Hide 'Screen Options' tab | |
function remove_screen_options_tab() { | |
return false; | |
} | |
add_filter( 'screen_options_show_screen', 'remove_screen_options_tab' ); | |
// Hide Help tab | |
function hide_help() { | |
echo '<style type="text/css">#contextual-help-link-wrap { display: none !important; }</style>'; | |
} | |
add_action( 'admin_head', 'hide_help' ); | |
// Remove WordPress menu from WP logo | |
function wplogomenu_admin_bar_remove() { | |
global $wp_admin_bar; | |
$wp_admin_bar->remove_menu( 'wp-logo' ); | |
} | |
add_action( 'wp_before_admin_bar_render', 'wplogomenu_admin_bar_remove', 0 ); | |
// Removes Yoasts SEO Page analysis - http://yoast.com/wordpress/seo/api/#filters | |
add_filter( 'wpseo_use_page_analysis', '__return_false' ); | |
// Change Welcome In Admin Bar | |
function wp_user_admin_bar_menu( $wp_admin_bar ) { | |
$user_id = get_current_user_id(); | |
$current_user = wp_get_current_user(); | |
$profile_url = get_edit_profile_url( $user_id ); | |
if ( 0 != $user_id ) | |
{ | |
// Add the "My Account" menu | |
$avatar = get_avatar( $user_id, 28 ); | |
$howdy = sprintf( __('Welcome back %1$s'), $current_user->display_name ); | |
$class = empty( $avatar ) ? '' : 'with-avatar'; | |
$wp_admin_bar->add_menu( array( | |
'id' => 'my-account', | |
'parent' => 'top-secondary', | |
'title' => $howdy . $avatar, | |
'href' => $profile_url, | |
'meta' => array( | |
'class' => $class, | |
), | |
) ); | |
} | |
} | |
add_action( 'admin_bar_menu', 'wp_user_admin_bar_menu', 11 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment