-
Notifications
You must be signed in to change notification settings - Fork 0
/
howdy.php
43 lines (37 loc) · 1020 Bytes
/
howdy.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
/**
* Plugin Name: Howdy
* Description: Remove "Howdy" from the admin bar.
* Version: 1.0.0
* Author: Brad Parbs
* Author URI: https://bradparbs.com/
* License: GPLv2
* Text Domain: howdy
* Domain Path: /lang/
*
* @package howdy
*/
namespace Howdy;
add_filter( 'admin_bar_menu', function( $bar ) {
if ( is_admin_bar_showing() ) {
$bar->add_node( [
'id' => 'my-account',
'title' => wp_get_current_user()->display_name,
]);
$bar->add_node(
[
'parent' => 'user-actions',
'id' => 'user-info',
'title' => sprintf( "<span class='display-name'>%s</span>", wp_get_current_user()->display_name ),
'href' => get_dashboard_url( get_current_user_id(), 'profile.php' ),
'meta' => [ 'tabindex' => -1 ],
]
);
}
return $bar;
}, 999 );
add_action( 'admin_enqueue_scripts', function() {
if ( is_admin_bar_showing() ) {
wp_add_inline_style( 'admin-bar', "#wpadminbar #wp-admin-bar-user-actions > li { margin-left: 16px !important; }" );
}
});