Make WordPress Core

Changeset 59905


Ignore:
Timestamp:
03/03/2025 05:20:36 PM (3 months ago)
Author:
joemcgill
Message:

Editor: Support Stylebook in the Site Editor for classic themes.

This modifies the submenu for the Site Editor which previously linked directly to the Patterns page after [58278] to support accessing the Stylebook in classic themes via a new "Design" link. Currently, any classic themes that have either added support for editor-styles or have a theme.json file will automatically see this new link in the admin menu.

Props isabel_brison, poena, wildworks, mamaduka, karmatosed, joemcgill.
Fixes #62509.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/menu.php

    r59784 r59905  
    212212    $submenu['themes.php'][6] = array( _x( 'Editor', 'site editor menu item' ), 'edit_theme_options', 'site-editor.php' );
    213213} else {
    214     $submenu['themes.php'][6] = array( _x( 'Patterns', 'patterns menu item' ), 'edit_theme_options', 'site-editor.php?path=/patterns' );
     214    $supports_stylebook = ( current_theme_supports( 'editor-styles' ) || wp_theme_has_theme_json() );
     215
     216    if ( $supports_stylebook ) {
     217        $submenu['themes.php'][6] = array( _x( 'Design', 'design menu item' ), 'edit_theme_options', 'site-editor.php' );
     218    } else {
     219        $submenu['themes.php'][6] = array( _x( 'Patterns', 'patterns menu item' ), 'edit_theme_options', 'site-editor.php?p=/pattern' );
     220    }
    215221}
    216222
Note: See TracChangeset for help on using the changeset viewer.