wppaste
WordPress

wp_admin_bar_appearance_menu( WP_Admin_Bar $wp_admin_bar )

Since
3.1.0
Source
wp-includes/admin-bar.php:1135
Adds appearance submenu items to the "Site Name" menu.

Parameters

$wp_admin_barWP_Admin_Bar
The WP_Admin_Bar instance.

Uses · 5

  • current_user_can()Returns whether the current user has the specified capability.
  • __()Retrieves the translation of $text.
  • admin_url()Retrieves the URL to the admin area for the current site.
  • current_theme_supports()Checks a theme's support for a given feature.
  • _x()Retrieves translated string with gettext context.

Used by · 1

Source

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_node(			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_node(			array(				'parent' => 'appearance',				'id'     => 'widgets',				'title'  => __( 'Widgets' ),				'href'   => admin_url( 'widgets.php' ),			)		);	} 	if ( current_theme_supports( 'menus' ) || current_theme_supports( 'widgets' ) ) {		$wp_admin_bar->add_node(			array(				'parent' => 'appearance',				'id'     => 'menus',				'title'  => __( 'Menus' ),				'href'   => admin_url( 'nav-menus.php' ),			)		);	} 	if ( current_theme_supports( 'custom-background' ) ) {		$wp_admin_bar->add_node(			array(				'parent' => 'appearance',				'id'     => 'background',				'title'  => _x( 'Background', 'custom 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_node(			array(				'parent' => 'appearance',				'id'     => 'header',				'title'  => _x( 'Header', 'custom image header' ),				'href'   => admin_url( 'themes.php?page=custom-header' ),				'meta'   => array(					'class' => 'hide-if-customize',				),			)		);	}}

History

Introduced in 3.1.0. Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

About this page

Parsed data
Generated from the wordpress-develop 7.0.4 tag, from src/wp-includes/admin-bar.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.