wp_is_block_theme example

$editor_settings['templateLock'] = ! empty( $post_type_object->template_lock ) ? $post_type_object->template_lock : false;
}

// If there's no template set on a new post, use the post format, instead. if ( $is_new_post && ! isset( $editor_settings['template'] ) && 'post' === $post->post_type ) {
    $post_format = get_post_format( $post );
    if ( in_array( $post_format, array( 'audio', 'gallery', 'image', 'quote', 'video' ), true ) ) {
        $editor_settings['template'] = array( array( "core/$post_format) );
    }
}

if ( wp_is_block_theme() && $editor_settings['supportsTemplateMode'] ) {
    $editor_settings['defaultTemplatePartAreas'] = get_allowed_block_template_part_areas();
}

/** * Scripts */
wp_enqueue_media(
    array(
        'post' => $post->ID,
    )
);

    public static function output_footer_assets() {
        if ( ! empty( self::$used_svg_filter_data ) ) {
            echo self::get_svg_definitions( self::$used_svg_filter_data );
        }

        // In block themes, the CSS is added in the head via wp_add_inline_style in the wp_enqueue_scripts action.         if ( ! wp_is_block_theme() ) {
            $style_tag_id = 'core-block-supports-duotone';
            wp_register_style( $style_tag_id, false );
            if ( ! empty( self::$used_global_styles_presets ) ) {
                wp_add_inline_style( $style_tag_id, self::get_global_styles_presets( self::$used_global_styles_presets ) );
            }
            if ( ! empty( self::$block_css_declarations ) ) {
                wp_add_inline_style( $style_tag_idwp_style_engine_get_stylesheet_from_css_rules( self::$block_css_declarations ) );
            }
            wp_enqueue_style( $style_tag_id );
        }
    }

    

add_action( 'init', 'register_block_core_post_comments_form' );

/** * Use the button block classes for the form-submit button. * * @param array $fields The default comment form arguments. * * @return array Returns the modified fields. */
function post_comments_form_block_form_defaults( $fields ) {
    if ( wp_is_block_theme() ) {
        $fields['submit_button'] = '<input name="%1$s" type="submit" id="%2$s" class="wp-block-button__link ' . wp_theme_get_element_class_name( 'button' ) . '" value="%4$s" />';
        $fields['submit_field']  = '<p class="form-submit wp-block-button">%1$s %2$s</p>';
    }

    return $fields;
}
<?php // Outer panel and sections are not implemented, but its here as a placeholder to avoid any side-effect in api.Section. ?></ul> </div> </div> <div id="widgets-right" class="wp-clearfix"><!-- For Widget Customizer, many widgets try to look for instances under div#widgets-right, so we have to add that ID to a container div in the Customizer for compat --> <div id="customize-notifications-area" class="customize-control-notifications-container"> <ul></ul> </div> <div class="wp-full-overlay-sidebar-content" tabindex="-1"> <div id="customize-info" class="accordion-section customize-info" data-block-theme="<?php echo (int) wp_is_block_theme(); ?>"> <div class="accordion-section-title"> <span class="preview-notice"> <?php                             /* translators: %s: The site/panel title in the Customizer. */
                            printf( __( 'You are customizing %s' ), '<strong class="panel-title site-title">' . get_bloginfo( 'name', 'display' ) . '</strong>' );
                        ?> </span> <button type="button" class="customize-help-toggle dashicons dashicons-editor-help" aria-expanded="false"><span class="screen-reader-text"> <?php                             /* translators: Hidden accessibility text. */
                            _e( 'Help' );
                            
/** * Registers the previous theme's sidebars for the block themes. * * @since 6.2.0 * @access private * * @global array $wp_registered_sidebars Registered sidebars. */
function _wp_block_theme_register_classic_sidebars() {
    global $wp_registered_sidebars;

    if ( ! wp_is_block_theme() ) {
        return;
    }

    $classic_sidebars = get_theme_mod( 'wp_classic_sidebars' );
    if ( empty( $classic_sidebars ) ) {
        return;
    }

    // Don't use `register_sidebar` since it will enable the `widgets` support for a theme.     foreach ( $classic_sidebars as $sidebar ) {
        $wp_registered_sidebars[ $sidebar['id'] ] = $sidebar;
    }

function wp_get_post_content_block_attributes() {
    global $post_ID;

    $is_block_theme = wp_is_block_theme();

    if ( ! $is_block_theme || ! $post_ID ) {
        return array();
    }

    $template_slug = get_page_template_slug( $post_ID );

    if ( ! $template_slug ) {
        $post_slug      = 'singular';
        $page_slug      = 'singular';
        $template_types = get_block_templates();

        
function wp_dashboard_empty() {}

/** * Displays a welcome panel to introduce users to WordPress. * * @since 3.3.0 * @since 5.9.0 Send users to the Site Editor if the active theme is block-based. */
function wp_welcome_panel() {
    list( $display_version ) = explode( '-', get_bloginfo( 'version' ) );
    $can_customize           = current_user_can( 'customize' );
    $is_block_theme          = wp_is_block_theme();
    ?> <div class="welcome-panel-content"> <div class="welcome-panel-header"> <div class="welcome-panel-header-image"> <?php echo file_get_contents( dirname( __DIR__ ) . '/images/dashboard-background.svg' ); ?> </div> <h2><?php _e( 'Welcome to WordPress!' ); ?></h2> <p> <a href="<?php echo esc_url( admin_url( 'about.php' ) ); ?>"> <?php                 /* translators: %s: Current WordPress version. */
                

function wp_admin_bar_edit_site_menu( $wp_admin_bar ) {
    global $_wp_current_template_id;

    // Don't show if a block theme is not activated.     if ( ! wp_is_block_theme() ) {
        return;
    }

    // Don't show for users who can't edit theme options or when in the admin.     if ( ! current_user_can( 'edit_theme_options' ) || is_admin() ) {
        return;
    }

    $wp_admin_bar->add_node(
        array(
            'id'    => 'site-editor',
            

    $count = sprintf(
        '<span class="update-plugins count-%s"><span class="theme-count">%s</span></span>',
        $update_data['counts']['themes'],
        number_format_i18n( $update_data['counts']['themes'] )
    );
}

    /* translators: %s: Number of available theme updates. */
    $submenu['themes.php'][5] = array( sprintf( __( 'Themes %s' )$count )$appearance_cap, 'themes.php' );

if ( wp_is_block_theme() ) {
    $submenu['themes.php'][6] = array( _x( 'Editor', 'site editor menu item' ), 'edit_theme_options', 'site-editor.php' );
}

if ( ! wp_is_block_theme() && current_theme_supports( 'block-template-parts' ) ) {
    $submenu['themes.php'][6] = array(
        __( 'Template Parts' ),
        'edit_theme_options',
        'site-editor.php?path=/wp_template_part/all',
    );
}

ARRAY_FILTER_USE_BOTH
    );
}

/** * Enqueues the global styles defined via theme.json. * * @since 5.8.0 */
function wp_enqueue_global_styles() {
    $separate_assets  = wp_should_load_separate_core_block_assets();
    $is_block_theme   = wp_is_block_theme();
    $is_classic_theme = ! $is_block_theme;

    /* * Global styles should be printed in the head when loading all styles combined. * The footer should only be used to print global styles for classic themes with separate core assets enabled. * * See https://core.trac.wordpress.org/ticket/53494. */
    if (
        ( $is_block_theme && doing_action( 'wp_footer' ) ) ||
        ( $is_classic_theme && doing_action( 'wp_footer' ) && ! $separate_assets ) ||
        (

function wp_widgets_add_menu() {
    global $submenu;

    if ( ! current_theme_supports( 'widgets' ) ) {
        return;
    }

    $menu_name = __( 'Widgets' );
    if ( wp_is_block_theme() || current_theme_supports( 'block-template-parts' ) ) {
        $submenu['themes.php'][] = array( $menu_name, 'edit_theme_options', 'widgets.php' );
    } else {
        $submenu['themes.php'][7] = array( $menu_name, 'edit_theme_options', 'widgets.php' );
    }

    ksort( $submenu['themes.php'], SORT_NUMERIC );
}

/** * Flushes all output buffers for PHP 5.2. * * Make sure all output buffers are flushed before our singletons are destroyed. * * @since 2.2.0 */
/** WordPress Administration Bootstrap */
require_once __DIR__ . '/admin.php';

if ( ! current_user_can( 'edit_theme_options' ) ) {
    wp_die(
        '<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' .
        '<p>' . __( 'Sorry, you are not allowed to edit theme options on this site.' ) . '</p>',
        403
    );
}

if ( ! ( current_theme_supports( 'block-template-parts' ) || wp_is_block_theme() ) ) {
    wp_die( __( 'The theme you are currently using is not compatible with the Site Editor.' ) );
}

$is_template_part = isset( $_GET['postType'] ) && 'wp_template_part' === sanitize_key( $_GET['postType'] );
$is_template_part_path = isset( $_GET['path'] ) && 'wp_template_partall' === sanitize_key( $_GET['path'] );
$is_template_part_editor = $is_template_part || $is_template_part_path;

if ( ! wp_is_block_theme() && ! $is_template_part_editor ) {
    wp_die( __( 'The theme you are currently using is not compatible with the Site Editor.' ) );
}

<?php }

/** * Enables the block templates (editor mode) for themes with theme.json by default. * * @access private * @since 5.8.0 */
function wp_enable_block_templates() {
    if ( wp_is_block_theme() || wp_theme_has_theme_json() ) {
        add_theme_support( 'block-templates' );
    }
}
<?php if ( isset( $_GET['a'] ) ) : ?> <div id="message" class="updated notice is-dismissible"> <p><?php _e( 'File edited successfully.' ); ?></p> </div> <?php elseif ( is_wp_error( $edit_error ) ) : ?> <div id="message" class="notice notice-error"> <p><?php _e( 'There was an error while trying to update the file. You may need to fix something and try updating again.' ); ?></p> <pre><?php echo esc_html( $edit_error->get_error_message() ? $edit_error->get_error_message() : $edit_error->get_error_code() ); ?></pre> </div> <?php endif; ?> <?php if ( preg_match( '/\.css$/', $file ) && ! wp_is_block_theme() && current_user_can( 'customize' ) ) : ?> <div id="message" class="notice-info notice"> <p><strong><?php _e( 'Did you know?' ); ?></strong></p> <p> <?php             printf(
                /* translators: %s: Link to Custom CSS section in the Customizer. */
                __( 'There is no need to change your CSS here &mdash; you can edit and live preview CSS changes in the <a href="%s">built-in CSS editor</a>.' ),
                esc_url( add_query_arg( 'autofocus[section]', 'custom_css', admin_url( 'customize.php' ) ) )
            );
            ?> </p> </div>


/** * Adds default theme supports for block themes when the 'setup_theme' action fires. * * See {@see 'setup_theme'}. * * @since 5.9.0 * @access private */
function _add_default_theme_supports() {
    if ( ! wp_is_block_theme() ) {
        return;
    }

    add_theme_support( 'post-thumbnails' );
    add_theme_support( 'responsive-embeds' );
    add_theme_support( 'editor-styles' );
    /* * Makes block themes support HTML5 by default for the comment block and search form * (which use default template functions) and `[caption]` and `[gallery]` shortcodes. * Other blocks contain their own HTML5 markup. */
    
Home | Imprint | This part of the site doesn't use cookies.