Created
March 25, 2021 18:27
-
-
Save ryelle/5f38c7f2c7b5d99ca5a8e9f60a073611 to your computer and use it in GitHub Desktop.
Add extra items to the top level of the WordPress admin bar
This file contains 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: Admin Bar Items | |
*/ | |
add_action( | |
'admin_bar_menu', | |
function( $admin_bar ) { | |
$admin_bar->add_menu( array( | |
'id' => 'ryelle-demo-1', | |
'parent' => null, | |
'group' => null, | |
'title' => '<span class="dashicons dashicons-controls-volumeon" style="font-family:dashicons;"></span> Long Menu Title', | |
'href' => admin_url('admin.php?page=custom-page'), | |
) ); | |
$admin_bar->add_menu( array( | |
'id' => 'ryelle-demo-2', | |
'parent' => null, | |
'group' => null, | |
'title' => '<span class="dashicons dashicons-format-status" style="font-family:dashicons;color:#68de7c;"></span> Status', | |
// 'href' => admin_url('admin.php?page=custom-page'), | |
) ); | |
$admin_bar->add_menu( array( | |
'id' => 'ryelle-demo-3', | |
'parent' => null, | |
'group' => null, | |
'title' => '<span class="dashicons dashicons-admin-site-alt3" style="font-family:dashicons;"></span> View', | |
'href' => admin_url('admin.php?page=custom-page'), | |
) ); | |
}, | |
100 | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment