public static function admin_bar_menu( $wp_admin_bar ) {
		$themes  = self::get_allowed_themes();
		$current = empty( self::$theme ) ? wp_get_theme() : self::$theme;
		unset( $themes[ $current->get( 'Name' ) ] );
		uksort( $themes, array( __CLASS__, 'sort_core_themes' ) );

		$title = apply_filters( 'tts_root_title', sprintf( __( 'Theme: %s', 'toolbar-theme-switcher' ), $current->display( 'Name' ) ) );

		$wp_admin_bar->add_menu( array(
			'id'    => 'toolbar_theme_switcher',
			'title' => $title,
			'href'  => admin_url( 'themes.php' ),
		) );

		$ajax_url = admin_url( 'admin-ajax.php' );

		foreach ( $themes as $theme ) {

			$href = add_query_arg( array(
				'action' => 'tts_set_theme',
				'theme'  => urlencode( $theme->get_stylesheet() ),
			), $ajax_url );

			$wp_admin_bar->add_menu( array(
				'id'     => $theme['Stylesheet'],
				'title'  => $theme->display( 'Name' ),
				'href'   => $href,
				'parent' => 'toolbar_theme_switcher',
			) );
		}
	}
public static function admin_bar_menu( $wp_admin_bar ) {
		$themes  = self::get_allowed_themes();
		$current = empty( self::$theme ) ? wp_get_theme() : self::$theme;
		unset( $themes[ $current->get( 'Name' ) ] );
		uksort( $themes, array( __CLASS__, 'sort_core_themes' ) );

		$title = apply_filters( 'tts_root_title', sprintf( __( 'Theme: %s', 'toolbar-theme-switcher' ), $current->display( 'Name' ) ) );

		$wp_admin_bar->add_menu( array(
			'id'    => 'toolbar_theme_switcher',
			'title' => $title,
			'href'  => admin_url( 'themes.php' ),
		) );

		$ajax_url = admin_url( 'admin-ajax.php' );

		foreach ( $themes as $theme ) {

			$href = add_query_arg( array(
				'action' => 'tts_set_theme',
				'theme'  => urlencode( $theme->get_stylesheet() ),
			), $ajax_url );

			$wp_admin_bar->add_menu( array(
				'id'     => $theme['Stylesheet'],
				'title'  => $theme->display( 'Name' ),
				'href'   => $href,
				'parent' => 'toolbar_theme_switcher',
			) );
		}
	}
public static function admin_bar_menu ( $ wp_admin_bar ) { $ themes = self :: get_allowed_themes ( ) ; $ current = empty ( self :: $ theme ) ? wp_get_theme ( ) : self :: $ theme ; unset ( $ themes [ $ current -> get ( 'Name' ) ] ) ; uksort ( $ themes , array ( __CLASS__ , 'sort_core_themes' ) ) ; $ title = apply_filters ( 'tts_root_title' , sprintf ( __ ( 'Theme: %s' , 'toolbar-theme-switcher' ) , $ current -> display ( 'Name' ) ) ) ; $ wp_admin_bar -> add_menu ( array ( 'id' => 'toolbar_theme_switcher' , 'title' => $ title , 'href' => admin_url ( 'themes.php' ) , ) ) ; $ ajax_url = admin_url ( 'admin-ajax.php' ) ; foreach ( $ themes as $ theme ) { $ href = add_query_arg ( array ( 'action' => 'tts_set_theme' , 'theme' => urlencode ( $ theme -> get_stylesheet ( ) ) , ) , $ ajax_url ) ; $ wp_admin_bar -> add_menu ( array ( 'id' => $ theme [ 'Stylesheet' ] , 'title' => $ theme -> display ( 'Name' ) , 'href' => $ href , 'parent' => 'toolbar_theme_switcher' , ) ) ; } }
Creates menu in toolbar.

@param WP_Admin_Bar $wp_admin_bar Admin bar instance.
Creates menu in toolbar .