Created
June 28, 2011 14:53
-
-
Save wildiney/1051304 to your computer and use it in GitHub Desktop.
WordPress - Add custom button on 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 | |
function mytheme_admin_bar_render() { | |
global $wp_admin_bar; | |
$wp_admin_bar->add_menu( array( | |
'parent' => 'new-content', // use 'false' for a root menu, or pass the ID of the parent menu | |
'id' => 'new_media', // link ID, defaults to a sanitized title value | |
'title' => __('Media'), // link title | |
'href' => admin_url( 'media-new.php'), // name of file | |
'meta' => false // array of any of the following options: array( 'html' => '', 'class' => '', 'onclick' => '', target => '', title => '' ); | |
)); | |
} | |
add_action( 'wp_before_admin_bar_render', 'mytheme_admin_bar_render' ); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment