Last active
April 14, 2024 08:56
-
-
Save nathaningram/b1a23dcdb665fbefc3e94f23e17d643e to your computer and use it in GitHub Desktop.
Creating a Starter Site - Custom Functions - Dashboard
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
| <?php | |
| /* | |
| Plugin Name: Custom Dashboard Functions | |
| Plugin URI: https://nathaningram.com | |
| Description: Customize the WP Admin | |
| Version: 2023.11 | |
| Author: Nathan Ingram | |
| Author URI: https://nathaningram.com | |
| License: GPL2 | |
| */ | |
| // Security Check | |
| if (!defined('ABSPATH')) { | |
| die(); | |
| } | |
| // Replace Howdy | |
| function ni_replace_howdy( $wp_admin_bar ) { | |
| $my_account=$wp_admin_bar->get_node('my-account'); | |
| $newtitle = str_replace( 'Howdy,', 'Welcome,', $my_account->title ); | |
| $wp_admin_bar->add_node( array( | |
| 'id' => 'my-account', | |
| 'title' => $newtitle, | |
| ) ); | |
| } | |
| add_filter( 'admin_bar_menu', 'ni_replace_howdy',25 ); | |
| // Remove WP Dashboard Menu | |
| function ni_admin_bar_remove() { | |
| global $wp_admin_bar; | |
| $wp_admin_bar->remove_menu('wp-logo'); | |
| } | |
| add_action('wp_before_admin_bar_render', 'ni_admin_bar_remove', 0); | |
| // Remove Dashboard Widgets | |
| function ni_remove_dashboard_widgets() { | |
| global $wp_meta_boxes; | |
| // Activity Widget | |
| unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_activity']); | |
| // At a Glance Widget | |
| unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_right_now']); | |
| // Quick Draft Widget | |
| unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_quick_press']); | |
| // News Widget | |
| unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_primary']) ; | |
| //Site Health | |
| unset($wp_meta_boxes['dashboard']['normal']['core']['dashboard_site_health']); | |
| //Events Calendar | |
| unset( $wp_meta_boxes['dashboard']['normal']['core']['tribe_dashboard_widget'] ); | |
| //WooSetup | |
| unset( $wp_meta_boxes['dashboard']['normal']['high']['wc_admin_dashboard_setup'] ); | |
| //Gravity Forms | |
| unset( $wp_meta_boxes['dashboard']['normal']['core']['rg_forms_dashboard'] ); | |
| } | |
| add_action('wp_dashboard_setup', 'ni_remove_dashboard_widgets',11); | |
| // Disable Site Health Admin Menu | |
| function ni_remove_site_health_menu() { | |
| remove_submenu_page( 'tools.php', 'site-health.php' ); | |
| } | |
| add_action( 'admin_menu', 'ni_remove_site_health_menu' ); | |
| // Modify Thank You Footer Text | |
| add_filter('admin_footer_text', 'ni_modify_footer_admin'); | |
| function ni_modify_footer_admin () { | |
| echo '<div style="float:left;margin-right:8px;""> | |
| <img src="//nathaningram-archive.s3.amazonaws.com/icons/brilliant-bulb.svg" height="32" width="32"> | |
| </div> | |
| <div style="height:8px;"> </div> | |
| <span><a href="https://brilliantly.net" target="_blank" style="color:#555d66;text-decoration:none;font-weight:bold;">Brilliant Web Works</a> – Custom WordPress Management System</span>'; | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment