Make WordPress Core


Ignore:
Timestamp:
02/06/2024 07:40:21 PM (10 months ago)
Author:
youknowriad
Message:

Editor: Show the patterns page for classic themes.

Block themes and classic themes with template parts support
can already access the patterns list within the site editor.
This adds a "Patterns" menu item under Appearance for classic themes
without template parts support.

Props wildworks, kevin940726, aaronrobertshaw, fabiankaegy, swissspidy, get_dave, kebbet.
Fixes #58827.

File:
1 edited

Legend:

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

    r57159 r57543  
    206206if ( wp_is_block_theme() ) {
    207207    $submenu['themes.php'][6] = array( _x( 'Editor', 'site editor menu item' ), 'edit_theme_options', 'site-editor.php' );
     208} else {
     209    $submenu['themes.php'][6] = array( __( 'Patterns', 'site editor menu item' ), 'edit_theme_options', 'edit.php?post_type=wp_block' );
    208210}
    209211
    210212if ( ! wp_is_block_theme() && current_theme_supports( 'block-template-parts' ) ) {
    211     $submenu['themes.php'][6] = array(
     213    $submenu['themes.php'][7] = array(
    212214        __( 'Template Parts' ),
    213215        'edit_theme_options',
     
    221223// is using 'customize_register' to add a setting.
    222224if ( ! wp_is_block_theme() || has_action( 'customize_register' ) ) {
    223     $position = ( wp_is_block_theme() || current_theme_supports( 'block-template-parts' ) ) ? 7 : 6;
     225    $position = ! wp_is_block_theme() && current_theme_supports( 'block-template-parts' ) ? 8 : 7;
    224226
    225227    $submenu['themes.php'][ $position ] = array( __( 'Customize' ), 'customize', esc_url( $customize_url ), '', 'hide-if-no-customize' );
Note: See TracChangeset for help on using the changeset viewer.