Make WordPress Core

Changeset 52158


Ignore:
Timestamp:
11/15/2021 03:42:08 AM (5 years ago)
Author:
noisysocks
Message:

Editor: Fix how the Site Editor is linked to

  • Add 'Edit site' to the top admin bar.
  • Link to the Template and Template Part CPTs.
  • Add deep link to the Global Styles UI.

Follows [52069].
See #54337.

Location:
trunk/src
Files:
4 edited

Legend:

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

    r52069 r52158  
    213213                'site-editor.php',
    214214        );
     215
     216        $submenu['themes.php'][7] = array(
     217                __( 'Styles' ),
     218                'edit_theme_options',
     219                'site-editor.php?styles=open',
     220        );
    215221}
    216222
  • trunk/src/wp-includes/admin-bar.php

    r52134 r52158  
    410410
    411411/**
     412 * Adds the "Edit site" link to the Toolbar.
     413 *
     414 * @since 5.9.0
     415 *
     416 * @param WP_Admin_Bar $wp_admin_bar The WP_Admin_Bar instance.
     417 */
     418function wp_admin_bar_edit_site_menu( $wp_admin_bar ) {
     419        // Don't show if a block theme is not activated.
     420        if ( ! wp_is_block_template_theme() ) {
     421                return;
     422        }
     423
     424        // Don't show for users who can't edit theme options or when in the admin.
     425        if ( ! current_user_can( 'edit_theme_options' ) || is_admin() ) {
     426                return;
     427        }
     428
     429        $wp_admin_bar->add_node(
     430                array(
     431                        'id'    => 'site-editor',
     432                        'title' => __( 'Edit site' ),
     433                        'href'  => admin_url( 'site-editor.php' ),
     434                )
     435        );
     436}
     437
     438/**
    412439 * Adds the "Customize" link to the Toolbar.
    413440 *
    … …  
    419446function wp_admin_bar_customize_menu( $wp_admin_bar ) {
    420447        global $wp_customize;
     448
     449        // Don't show if a block theme is activated.
     450        if ( wp_is_block_template_theme() ) {
     451                return;
     452        }
    421453
    422454        // Don't show for users who can't access the customizer or when in the admin.
    … …  
    429461                && ! current_user_can( get_post_type_object( 'customize_changeset' )->cap->edit_post, $wp_customize->changeset_post_id() )
    430462        ) {
    431                 return;
    432         }
    433 
    434         // Don't show if a block theme is activated.
    435         if ( wp_is_block_template_theme() ) {
    436463                return;
    437464        }
  • trunk/src/wp-includes/class-wp-admin-bar.php

    r51876 r52158  
    643643                add_action( 'admin_bar_menu', 'wp_admin_bar_my_sites_menu', 20 );
    644644                add_action( 'admin_bar_menu', 'wp_admin_bar_site_menu', 30 );
     645                add_action( 'admin_bar_menu', 'wp_admin_bar_edit_site_menu', 40 );
    645646                add_action( 'admin_bar_menu', 'wp_admin_bar_customize_menu', 40 );
    646647                add_action( 'admin_bar_menu', 'wp_admin_bar_updates_menu', 50 );
  • trunk/src/wp-includes/post.php

    r52145 r52158  
    341341                                'edit_item'             => __( 'Edit Template' ),
    342342                                'view_item'             => __( 'View Template' ),
    343                                 'all_items'             => __( 'All Templates' ),
     343                                'all_items'             => __( 'Templates' ),
    344344                                'search_items'          => __( 'Search Templates' ),
    345345                                'parent_item_colon'     => __( 'Parent Template:' ),
    … …  
    357357                        '_builtin'              => true, /* internal use only. don't use this when registering your own post type. */
    358358                        'has_archive'           => false,
    359                         'show_ui'               => false,
    360                         'show_in_menu'          => false,
     359                        'show_ui'               => wp_is_block_template_theme(),
     360                        'show_in_menu'          => 'themes.php',
    361361                        'show_in_rest'          => true,
    362362                        'rewrite'               => false,
    … …  
    400400                                'edit_item'             => __( 'Edit Template Part' ),
    401401                                'view_item'             => __( 'View Template Part' ),
    402                                 'all_items'             => __( 'All Template Parts' ),
     402                                'all_items'             => __( 'Template Parts' ),
    403403                                'search_items'          => __( 'Search Template Parts' ),
    404404                                'parent_item_colon'     => __( 'Parent Template Part:' ),
    … …  
    416416                        '_builtin'              => true, /* internal use only. don't use this when registering your own post type. */
    417417                        'has_archive'           => false,
    418                         'show_ui'               => false,
    419                         'show_in_menu'          => false,
     418                        'show_ui'               => wp_is_block_template_theme(),
     419                        'show_in_menu'          => 'themes.php',
    420420                        'show_in_rest'          => true,
    421421                        'rewrite'               => false,
Note: See TracChangeset for help on using the changeset viewer.