Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions src/wp-admin/menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -224,31 +224,35 @@
/* translators: %s: Number of available theme updates. */
$submenu['themes.php'][5] = array( sprintf( __( 'Themes %s' ), $count ), $appearance_capability, 'themes.php' );

if ( ! is_multisite() ) {
$submenu['themes.php'][6] = array( __( 'Add Theme' ), 'install_themes', 'theme-install.php', '', 'hide-if-no-js' );
}

if ( wp_is_block_theme() ) {
$submenu['themes.php'][6] = array( _x( 'Editor', 'site editor menu item' ), 'edit_theme_options', 'site-editor.php' );
$submenu['themes.php'][7] = array( _x( 'Editor', 'site editor menu item' ), 'edit_theme_options', 'site-editor.php' );
} else {
$supports_stylebook = ( current_theme_supports( 'editor-styles' ) || wp_theme_has_theme_json() );

if ( $supports_stylebook ) {
$submenu['themes.php'][6] = array( _x( 'Design', 'design menu item' ), 'edit_theme_options', 'site-editor.php' );
$submenu['themes.php'][7] = array( _x( 'Design', 'design menu item' ), 'edit_theme_options', 'site-editor.php' );
} else {
$submenu['themes.php'][6] = array( _x( 'Patterns', 'patterns menu item' ), 'edit_theme_options', 'site-editor.php?p=/pattern' );
$submenu['themes.php'][7] = array( _x( 'Patterns', 'patterns menu item' ), 'edit_theme_options', 'site-editor.php?p=/pattern' );
}
}

// Font Library menu item.
$submenu['themes.php'][9] = array( __( 'Fonts' ), 'edit_theme_options', 'font-library.php' );
$submenu['themes.php'][10] = array( __( 'Fonts' ), 'edit_theme_options', 'font-library.php' );

$customize_url = add_query_arg( 'return', urlencode( remove_query_arg( wp_removable_query_args(), wp_unslash( $_SERVER['REQUEST_URI'] ) ) ), 'customize.php' );

// Hide Customize link on block themes unless a plugin or theme
// is using 'customize_register' to add a setting.
if ( ! wp_is_block_theme() || has_action( 'customize_register' ) ) {
$submenu['themes.php'][7] = array( __( 'Customize' ), 'customize', esc_url( $customize_url ), '', 'hide-if-no-customize' );
$submenu['themes.php'][8] = array( __( 'Customize' ), 'customize', esc_url( $customize_url ), '', 'hide-if-no-customize' );
}

if ( current_theme_supports( 'menus' ) || current_theme_supports( 'widgets' ) ) {
$submenu['themes.php'][10] = array( __( 'Menus' ), 'edit_theme_options', 'nav-menus.php' );
$submenu['themes.php'][11] = array( __( 'Menus' ), 'edit_theme_options', 'nav-menus.php' );
}

if ( current_theme_supports( 'custom-header' ) && current_user_can( 'customize' ) ) {
Expand Down
2 changes: 1 addition & 1 deletion src/wp-admin/theme-install.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
$parent_file = 'themes.php';

if ( ! is_network_admin() ) {
$submenu_file = 'themes.php';
$submenu_file = 'theme-install.php';
}

$installed_themes = search_theme_directories();
Expand Down
2 changes: 1 addition & 1 deletion src/wp-admin/update.php
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@
// Used in the HTML title tag.
$title = __( 'Install Themes' );
$parent_file = 'themes.php';
$submenu_file = 'themes.php';
$submenu_file = 'theme-install.php';

require_once ABSPATH . 'wp-admin/admin-header.php';

Expand Down
2 changes: 1 addition & 1 deletion src/wp-includes/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -5628,7 +5628,7 @@ function wp_widgets_add_menu() {
if ( wp_is_block_theme() ) {
$submenu['themes.php'][] = array( $menu_name, 'edit_theme_options', 'widgets.php' );
} else {
$submenu['themes.php'][8] = array( $menu_name, 'edit_theme_options', 'widgets.php' );
$submenu['themes.php'][9] = array( $menu_name, 'edit_theme_options', 'widgets.php' );
}

ksort( $submenu['themes.php'], SORT_NUMERIC );
Expand Down
Loading