wp_admin_bar_appearance_menu

Add appearance submenu items to the "Site Name" menu.

Description

wp_admin_bar_appearance_menu( (WP_Admin_Bar) $wp_admin_bar ); 

Parameters (1)

0. $wp_admin_bar (WP_Admin_Bar)
The wp admin bar.

Usage

  1. if ( !function_exists( 'wp_admin_bar_appearance_menu' ) ) { 
  2. require_once ABSPATH . WPINC . '/admin-bar.php'; 
  3.  
  4. // The wp admin bar. 
  5. $wp_admin_bar = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = wp_admin_bar_appearance_menu($wp_admin_bar); 
  9.  

Defined (1)

The function is defined in the following location(s).

/wp-includes/admin-bar.php  
  1. function wp_admin_bar_appearance_menu( $wp_admin_bar ) { 
  2. $wp_admin_bar->add_group( array( 'parent' => 'site-name', 'id' => 'appearance' ) ); 
  3.  
  4. if ( current_user_can( 'switch_themes' ) ) { 
  5. $wp_admin_bar->add_menu( array( 
  6. 'parent' => 'appearance',  
  7. 'id' => 'themes',  
  8. 'title' => __( 'Themes' ),  
  9. 'href' => admin_url( 'themes.php' ),  
  10. ) ); 
  11.  
  12. if ( ! current_user_can( 'edit_theme_options' ) ) { 
  13. return; 
  14.  
  15. if ( current_theme_supports( 'widgets' ) ) { 
  16. $wp_admin_bar->add_menu( array( 
  17. 'parent' => 'appearance',  
  18. 'id' => 'widgets',  
  19. 'title' => __( 'Widgets' ),  
  20. 'href' => admin_url( 'widgets.php' ),  
  21. ) ); 
  22.  
  23. if ( current_theme_supports( 'menus' ) || current_theme_supports( 'widgets' ) ) 
  24. $wp_admin_bar->add_menu( array( 'parent' => 'appearance', 'id' => 'menus', 'title' => __('Menus'), 'href' => admin_url('nav-menus.php') ) ); 
  25.  
  26. if ( current_theme_supports( 'custom-background' ) ) { 
  27. $wp_admin_bar->add_menu( array( 
  28. 'parent' => 'appearance',  
  29. 'id' => 'background',  
  30. 'title' => __( 'Background' ),  
  31. 'href' => admin_url( 'themes.php?page=custom-background' ),  
  32. 'meta' => array( 
  33. 'class' => 'hide-if-customize',  
  34. ),  
  35. ) ); 
  36.  
  37. if ( current_theme_supports( 'custom-header' ) ) { 
  38. $wp_admin_bar->add_menu( array( 
  39. 'parent' => 'appearance',  
  40. 'id' => 'header',  
  41. 'title' => __( 'Header' ),  
  42. 'href' => admin_url( 'themes.php?page=custom-header' ),  
  43. 'meta' => array( 
  44. 'class' => 'hide-if-customize',  
  45. ),  
  46. ) ); 
  47.