Make WordPress Core


Ignore:
Timestamp:
02/10/2020 10:31:13 PM (5 years ago)
Author:
jorgefilipecosta
Message:

Block Editor: Update WordPress Packages; Remove navigation block; Add social links block

The following package versions were changed:
@wordpress/annotations: 1.11.0 -> 1.12.0
@wordpress/api-fetch: 3.10.0 -> 3.11.0
@wordpress/block-directory: 1.4.0 -> 1.5.0
@wordpress/block-editor: 3.6.0 -> 3.7.0
@wordpress/block-library: 2.13.0 -> 2.14.0
@wordpress/blocks: 6.11.0 -> 6.12.0
@wordpress/components: 9.1.0 -> 9.2.0
@wordpress/core-data: 2.11.0 -> 2.12.0
@wordpress/data: 4.13.0 -> 4.14.0
@wordpress/data-controls: 1.7.0 -> 1.8.0
@wordpress/e2e-test-utils: 4.2.0 -> 4.3.0
@wordpress/edit-post: 3.12.0 -> 3.13.0
@wordpress/editor: 9.11.0 -> 9.12.0
@wordpress/format-library: 1.13.0 -> 1.14.0
@wordpress/icons: 1.0.0 -> 1.1.0
@wordpress/keyboard-shortcuts: 1.0.0 -> 1.1.0
@wordpress/list-reusable-blocks: 1.12.0 -> 1.13.0
@wordpress/media-utils: 1.6.0 -> 1.7.0
@wordpress/notices: 1.12.0 -> 2.0.0
@wordpress/nux: 3.11.0 -> 3.12.0
@wordpress/plugins: 2.11.0 -> 2.12.0
@wordpress/primitives: 1.0.0 -> 1.1.0
@wordpress/rich-text: 3.11.0 -> 3.12.0
@wordpress/server-side-render: 1.7.0 -> 1.8.0
@wordpress/url: 2.10.0 -> 2.11.0
@wordpress/viewport: 2.12.0 -> 2.13.0
The navigation block inclusion was reverted.
The social links block was included.

Props gziolo, youknowriad, mcsf, noisysocks.
Fixes #49397.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/blocks/latest-posts.php

    r46586 r47250  
    3030    $list_items_markup = '';
    3131
    32     $excerpt_length = $attributes['excerptLength'];
    33 
    3432    foreach ( $recent_posts as $post ) {
     33        $list_items_markup .= '<li>';
     34
     35        if ( $attributes['displayFeaturedImage'] && has_post_thumbnail( $post ) ) {
     36            $image_style = '';
     37            if ( isset( $attributes['featuredImageSizeWidth'] ) ) {
     38                $image_style .= sprintf( 'max-width:%spx;', $attributes['featuredImageSizeWidth'] );
     39            }
     40            if ( isset( $attributes['featuredImageSizeHeight'] ) ) {
     41                $image_style .= sprintf( 'max-height:%spx;', $attributes['featuredImageSizeHeight'] );
     42            }
     43
     44            $image_classes = 'wp-block-latest-posts__featured-image';
     45            if ( isset( $attributes['featuredImageAlign'] ) ) {
     46                $image_classes .= ' align' . $attributes['featuredImageAlign'];
     47            }
     48
     49            $list_items_markup .= sprintf(
     50                '<div class="%1$s">%2$s</div>',
     51                $image_classes,
     52                get_the_post_thumbnail(
     53                    $post,
     54                    $attributes['featuredImageSizeSlug'],
     55                    array(
     56                        'style' => $image_style,
     57                    )
     58                )
     59            );
     60        }
     61
    3562        $title = get_the_title( $post );
    3663        if ( ! $title ) {
     
    3865        }
    3966        $list_items_markup .= sprintf(
    40             '<li><a href="%1$s">%2$s</a>',
     67            '<a href="%1$s">%2$s</a>',
    4168            esc_url( get_permalink( $post ) ),
    4269            $title
     
    5380        if ( isset( $attributes['displayPostContent'] ) && $attributes['displayPostContent']
    5481            && isset( $attributes['displayPostContentRadio'] ) && 'excerpt' === $attributes['displayPostContentRadio'] ) {
    55             $post_excerpt = $post->post_excerpt;
    56             if ( ! ( $post_excerpt ) ) {
    57                 $post_excerpt = $post->post_content;
    58             }
    59             $trimmed_excerpt = esc_html( wp_trim_words( $post_excerpt, $excerpt_length, ' &hellip; ' ) );
     82
     83            $trimmed_excerpt = get_the_excerpt( $post );
    6084
    6185            $list_items_markup .= sprintf(
     
    170194                    'default' => 'date',
    171195                ),
     196                'displayFeaturedImage'    => array(
     197                    'type'    => 'boolean',
     198                    'default' => false,
     199                ),
     200                'featuredImageAlign'      => array(
     201                    'type' => 'string',
     202                    'enum' => array( 'left', 'center', 'right' ),
     203                ),
     204                'featuredImageSizeSlug'   => array(
     205                    'type'    => 'string',
     206                    'default' => 'thumbnail',
     207                ),
     208                'featuredImageSizeWidth'  => array(
     209                    'type'    => 'number',
     210                    'default' => null,
     211                ),
     212                'featuredImageSizeHeight' => array(
     213                    'type'    => 'number',
     214                    'default' => null,
     215                ),
    172216            ),
    173217            'render_callback' => 'render_block_core_latest_posts',
Note: See TracChangeset for help on using the changeset viewer.