Menus instead. if ( wp_is_block_theme() ) { gutenberg_register_site_editor_v2_menu_item( 'navigation', __( 'Navigation', 'gutenberg' ), '/navigation', '' ); } gutenberg_register_site_editor_v2_menu_item( 'pages', __( 'Pages', 'gutenberg' ), '/types/page', '' ); // Block themes and classic themes shipping a `theme.json` file opt in // automatically, other classic themes have to call // `add_theme_support( 'block-templates' )`. if ( current_theme_supports( 'block-templates' ) ) { gutenberg_register_site_editor_v2_menu_item( 'templates', __( 'Templates', 'gutenberg' ), '/templates', '' ); } // `block-template-parts` lets a classic theme opt into template parts alone, // as the Template Part block itself allows. if ( current_theme_supports( 'block-templates' ) || current_theme_supports( 'block-template-parts' ) ) { gutenberg_register_site_editor_v2_menu_item( 'templateParts', __( 'Template Parts', 'gutenberg' ), '/template-parts', '' ); } gutenberg_register_site_editor_v2_menu_item( 'patterns', __( 'Patterns', 'gutenberg' ), '/patterns', '' ); } add_action( 'site-editor-v2_init', 'gutenberg_site_editor_register_default_menu_items', 5 ); /** * Renders the admin bar on the site editor page. */ function gutenberg_site_editor_enable_admin_bar() { if ( ! is_admin_bar_showing() ) { return; } remove_action( 'admin_bar_menu', 'wp_admin_bar_sidebar_toggle', 0 ); add_action( 'admin_footer-site-editor-v2', 'wp_admin_bar_render' ); $admin_color = get_user_option( 'admin_color' ); if ( empty( $admin_color ) ) { $admin_color = 'modern'; } $admin_color_class = 'admin-color-' . sanitize_html_class( $admin_color ); add_action( 'admin_footer-site-editor-v2', static function () use ( $admin_color_class ) { echo ''; } ); wp_enqueue_script( 'admin-bar' ); wp_enqueue_style( 'admin-bar' ); wp_enqueue_style( 'colors' ); $css = <<