Last active
April 29, 2024 14:43
-
-
Save jodzeee/01ffb69417751f4c02bb1818409684d9 to your computer and use it in GitHub Desktop.
Add frequently used links to main menu of Admin Bar
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
/** Add frequently used links to main menu of Admin Bar */ | |
if ( ! function_exists( 'x_add_options_item_to_admin_bar' ) ) { | |
function x_add_options_item_to_admin_bar() { | |
global $wp_admin_bar; | |
$wp_admin_bar->add_menu( | |
array( | |
'parent' => 'site-name', | |
'id' => 'x_library', | |
'title' => __( 'Media Library', 'x' ), | |
'href' => esc_url( admin_url( 'upload.php' ) ), | |
'meta' => false | |
// array of any of the following options: array( 'html' => '', 'class' => '', 'onclick' => '', target => '', title => '' ); | |
) | |
); | |
$wp_admin_bar->add_menu( | |
array( | |
'parent' => 'site-name', | |
'id' => 'x_plugins', | |
'title' => __( 'Plugins', 'x' ), | |
'href' => esc_url( admin_url( 'plugins.php' ) ), | |
'meta' => false | |
// array of any of the following options: array( 'html' => '', 'class' => '', 'onclick' => '', target => '', title => '' ); | |
) | |
); | |
$wp_admin_bar->add_menu( | |
array( | |
'parent' => 'site-name', | |
'id' => 'x_wpcodebox', | |
'title' => __( 'WPCodeBox', 'x' ), | |
'href' => esc_url( admin_url( 'admin.php?page=wpcodebox2' ) ), | |
'meta' => false | |
// array of any of the following options: array( 'html' => '', 'class' => '', 'onclick' => '', target => '', title => '' ); | |
) | |
); | |
} | |
add_action( 'wp_before_admin_bar_render', 'x_add_options_item_to_admin_bar' ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment