Make WordPress Core


Ignore:
Timestamp:
12/07/2021 12:00:45 AM (4 years ago)
Author:
hellofromTonya
Message:

Themes: Better names for WP_Theme::is_block_theme() and wp_is_block_theme() and make wp_is_block_theme() a wrapper.

This commit renames the following method and function to better represent block theme terminology:

  • WP_Theme::is_block_based() to WP_Theme::is_block_theme()
  • wp_is_block_template_theme() to wp_is_block_theme()

It also changes wp_is_block_theme() to be a helper wrapper (sugar syntax) for wp_get_theme()->is_block_theme();. Why? To ensure both the method and function behave the same, to help Gutenberg maintain WordPress cross-version compatibility, and to make it less cumbersome to port changes from Gutenberg to Core.

Follow-up to [52069], [52247], [52279].

Props antonvlasenko, costdev, hellofromTonya, noisysocks.
Fixes #54550.

File:
1 edited

Legend:

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

    r52232 r52330  
    203203    $submenu['themes.php'][5] = array( sprintf( __( 'Themes %s' ), $count ), $appearance_cap, 'themes.php' );
    204204
    205 if ( wp_is_block_template_theme() ) {
     205if ( wp_is_block_theme() ) {
    206206    $submenu['themes.php'][6] = array(
    207207        sprintf(
     
    217217// Hide Customize link on block themes unless a plugin or theme is using
    218218// customize_register to add a setting.
    219 if ( ! wp_is_block_template_theme() || has_action( 'customize_register' ) ) {
     219if ( ! wp_is_block_theme() || has_action( 'customize_register' ) ) {
    220220    $customize_url = add_query_arg( 'return', urlencode( remove_query_arg( wp_removable_query_args(), wp_unslash( $_SERVER['REQUEST_URI'] ) ) ), 'customize.php' );
    221     $position      = wp_is_block_template_theme() ? 7 : 6;
     221    $position      = wp_is_block_theme() ? 7 : 6;
    222222
    223223    $submenu['themes.php'][ $position ] = array( __( 'Customize' ), 'customize', esc_url( $customize_url ), '', 'hide-if-no-customize' );
     
    256256function _add_themes_utility_last() {
    257257    add_submenu_page(
    258         wp_is_block_template_theme() ? 'tools.php' : 'themes.php',
     258        wp_is_block_theme() ? 'tools.php' : 'themes.php',
    259259        __( 'Theme Editor' ),
    260260        __( 'Theme Editor' ),
Note: See TracChangeset for help on using the changeset viewer.