Make WordPress Core


Ignore:
Timestamp:
06/28/2023 03:47:17 AM (3 years ago)
Author:
isabel_brison
Message:

Editor: add Post Template fallback styles.

Adds fallback styles necessary for classic themes to display the correct Post Template layout.

Props mikeschroder, ramonopoly.
Fixes #58570.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-theme-json.php

    r56058 r56083  
    10051005     * @since 5.8.0
    10061006     * @since 5.9.0 Removed the `$type` parameter, added the `$types` and `$origins` parameters.
     1007     * @since 6.3.0 Add fallback layout styles for Post Template when block gap support isn't available.
    10071008     *
    10081009     * @param string[] $types   Types of styles to load. Will load all by default. It accepts:
     
    10711072            $stylesheet .= $this->get_block_classes( $style_nodes );
    10721073        } elseif ( in_array( 'base-layout-styles', $types, true ) ) {
    1073             $root_selector    = static::ROOT_BLOCK_SELECTOR;
    1074             $columns_selector = '.wp-block-columns';
     1074            $root_selector          = static::ROOT_BLOCK_SELECTOR;
     1075            $columns_selector       = '.wp-block-columns';
     1076            $post_template_selector = '.wp-block-post-template';
    10751077            if ( ! empty( $options['scope'] ) ) {
    1076                 $root_selector    = static::scope_selector( $options['scope'], $root_selector );
    1077                 $columns_selector = static::scope_selector( $options['scope'], $columns_selector );
     1078                $root_selector          = static::scope_selector( $options['scope'], $root_selector );
     1079                $columns_selector       = static::scope_selector( $options['scope'], $columns_selector );
     1080                $post_template_selector = static::scope_selector( $options['scope'], $post_template_selector );
    10781081            }
    10791082            if ( ! empty( $options['root_selector'] ) ) {
     
    10921095                    'name'     => 'core/columns',
    10931096                ),
     1097                array(
     1098                    'path'     => array( 'styles', 'blocks', 'core/post-template' ),
     1099                    'selector' => $post_template_selector,
     1100                    'name'     => 'core/post-template',
     1101                ),
    10941102            );
    10951103
     
    12961304            if ( null !== $block_gap_value && false !== $block_gap_value && '' !== $block_gap_value ) {
    12971305                foreach ( $layout_definitions as $layout_definition_key => $layout_definition ) {
    1298                     // Allow outputting fallback gap styles for flex layout type when block gap support isn't available.
    1299                     if ( ! $has_block_gap_support && 'flex' !== $layout_definition_key ) {
     1306                    // Allow outputting fallback gap styles for flex and grid layout types when block gap support isn't available.
     1307                    if ( ! $has_block_gap_support && 'flex' !== $layout_definition_key && 'grid' !== $layout_definition_key ) {
    13001308                        continue;
    13011309                    }
Note: See TracChangeset for help on using the changeset viewer.