Posted By

nathanbweb on 05/11/11


Tagged

php wordpress admin


Versions (?)

WordPress custom links in admin bar


 / Published in: PHP
 

URL: http://bit.ly/wprec-adminlx

  1. // add custom links to admin bar
  2. // via bit.ly/wprec-adminlx
  3.  
  4. function mytheme_admin_bar_render() {
  5. global $wp_admin_bar;
  6. $wp_admin_bar->add_menu( array(
  7. 'parent' => 'new-content', // use 'false' for a root menu, or pass the ID of the parent menu
  8. 'id' => 'new_media', // link ID, defaults to a sanitized title value
  9. 'title' => __('Media'), // link title
  10. 'href' => admin_url( 'media-new.php'), // name of file
  11. 'meta' => false // array of any of the following options: array( 'html' => '', 'class' => '', 'onclick' => '', target => '', title => '' );
  12. ));
  13. }
  14. add_action( 'wp_before_admin_bar_render', 'mytheme_admin_bar_render' );

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: doobbbe on May 12, 2011

Thanks

You need to login to post a comment.