wp_admin_bar_sidebar_toggle() WordPress Function

The wp_admin_bar_sidebar_toggle() function allows you to toggle the display of the sidebar in the WordPress admin interface. This can be useful if you want to save some space on your screen, or if you want to see more of the content you're working on.

wp_admin_bar_sidebar_toggle( WP_Admin_Bar $wp_admin_bar ) #

Adds the sidebar toggle button.


Parameters

$wp_admin_bar

(WP_Admin_Bar)(Required)The WP_Admin_Bar instance.


Top ↑

Source

File: wp-includes/admin-bar.php

function wp_admin_bar_sidebar_toggle( $wp_admin_bar ) {
	if ( is_admin() ) {
		$wp_admin_bar->add_node(
			array(
				'id'    => 'menu-toggle',
				'title' => '<span class="ab-icon" aria-hidden="true"></span><span class="screen-reader-text">' . __( 'Menu' ) . '</span>',
				'href'  => '#',
			)
		);
	}
}


Top ↑

Changelog

Changelog
VersionDescription
3.8.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.