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
if ( !function_exists( 'wp_admin_bar_appearance_menu' ) ) { require_once ABSPATH . WPINC . '/admin-bar.php'; } // The wp admin bar. $wp_admin_bar = null; // NOTICE! Understand what this does before running. $result = wp_admin_bar_appearance_menu($wp_admin_bar);
Defined (1)
The function is defined in the following location(s).
- /wp-includes/admin-bar.php
- function wp_admin_bar_appearance_menu( $wp_admin_bar ) {
- $wp_admin_bar->add_group( array( 'parent' => 'site-name', 'id' => 'appearance' ) );
- if ( current_user_can( 'switch_themes' ) ) {
- $wp_admin_bar->add_menu( array(
- 'parent' => 'appearance',
- 'id' => 'themes',
- 'title' => __( 'Themes' ),
- 'href' => admin_url( 'themes.php' ),
- ) );
- }
- if ( ! current_user_can( 'edit_theme_options' ) ) {
- return;
- }
- if ( current_theme_supports( 'widgets' ) ) {
- $wp_admin_bar->add_menu( array(
- 'parent' => 'appearance',
- 'id' => 'widgets',
- 'title' => __( 'Widgets' ),
- 'href' => admin_url( 'widgets.php' ),
- ) );
- }
- if ( current_theme_supports( 'menus' ) || current_theme_supports( 'widgets' ) )
- if ( current_theme_supports( 'custom-background' ) ) {
- $wp_admin_bar->add_menu( array(
- 'parent' => 'appearance',
- 'id' => 'background',
- 'title' => __( 'Background' ),
- 'href' => admin_url( 'themes.php?page=custom-background' ),
- 'meta' => array(
- 'class' => 'hide-if-customize',
- ),
- ) );
- }
- if ( current_theme_supports( 'custom-header' ) ) {
- $wp_admin_bar->add_menu( array(
- 'parent' => 'appearance',
- 'id' => 'header',
- 'title' => __( 'Header' ),
- 'href' => admin_url( 'themes.php?page=custom-header' ),
- 'meta' => array(
- 'class' => 'hide-if-customize',
- ),
- ) );
- }
- }