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. Built from https://develop.svn.wordpress.org/trunk@47250 git-svn-id: http://core.svn.wordpress.org/trunk@47050 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -29,15 +29,42 @@ function render_block_core_latest_posts( $attributes ) {
|
||||
|
||||
$list_items_markup = '';
|
||||
|
||||
$excerpt_length = $attributes['excerptLength'];
|
||||
|
||||
foreach ( $recent_posts as $post ) {
|
||||
$list_items_markup .= '<li>';
|
||||
|
||||
if ( $attributes['displayFeaturedImage'] && has_post_thumbnail( $post ) ) {
|
||||
$image_style = '';
|
||||
if ( isset( $attributes['featuredImageSizeWidth'] ) ) {
|
||||
$image_style .= sprintf( 'max-width:%spx;', $attributes['featuredImageSizeWidth'] );
|
||||
}
|
||||
if ( isset( $attributes['featuredImageSizeHeight'] ) ) {
|
||||
$image_style .= sprintf( 'max-height:%spx;', $attributes['featuredImageSizeHeight'] );
|
||||
}
|
||||
|
||||
$image_classes = 'wp-block-latest-posts__featured-image';
|
||||
if ( isset( $attributes['featuredImageAlign'] ) ) {
|
||||
$image_classes .= ' align' . $attributes['featuredImageAlign'];
|
||||
}
|
||||
|
||||
$list_items_markup .= sprintf(
|
||||
'<div class="%1$s">%2$s</div>',
|
||||
$image_classes,
|
||||
get_the_post_thumbnail(
|
||||
$post,
|
||||
$attributes['featuredImageSizeSlug'],
|
||||
array(
|
||||
'style' => $image_style,
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
$title = get_the_title( $post );
|
||||
if ( ! $title ) {
|
||||
$title = __( '(no title)' );
|
||||
}
|
||||
$list_items_markup .= sprintf(
|
||||
'<li><a href="%1$s">%2$s</a>',
|
||||
'<a href="%1$s">%2$s</a>',
|
||||
esc_url( get_permalink( $post ) ),
|
||||
$title
|
||||
);
|
||||
@@ -52,11 +79,8 @@ function render_block_core_latest_posts( $attributes ) {
|
||||
|
||||
if ( isset( $attributes['displayPostContent'] ) && $attributes['displayPostContent']
|
||||
&& isset( $attributes['displayPostContentRadio'] ) && 'excerpt' === $attributes['displayPostContentRadio'] ) {
|
||||
$post_excerpt = $post->post_excerpt;
|
||||
if ( ! ( $post_excerpt ) ) {
|
||||
$post_excerpt = $post->post_content;
|
||||
}
|
||||
$trimmed_excerpt = esc_html( wp_trim_words( $post_excerpt, $excerpt_length, ' … ' ) );
|
||||
|
||||
$trimmed_excerpt = get_the_excerpt( $post );
|
||||
|
||||
$list_items_markup .= sprintf(
|
||||
'<div class="wp-block-latest-posts__post-excerpt">%1$s',
|
||||
@@ -169,6 +193,26 @@ function register_block_core_latest_posts() {
|
||||
'type' => 'string',
|
||||
'default' => 'date',
|
||||
),
|
||||
'displayFeaturedImage' => array(
|
||||
'type' => 'boolean',
|
||||
'default' => false,
|
||||
),
|
||||
'featuredImageAlign' => array(
|
||||
'type' => 'string',
|
||||
'enum' => array( 'left', 'center', 'right' ),
|
||||
),
|
||||
'featuredImageSizeSlug' => array(
|
||||
'type' => 'string',
|
||||
'default' => 'thumbnail',
|
||||
),
|
||||
'featuredImageSizeWidth' => array(
|
||||
'type' => 'number',
|
||||
'default' => null,
|
||||
),
|
||||
'featuredImageSizeHeight' => array(
|
||||
'type' => 'number',
|
||||
'default' => null,
|
||||
),
|
||||
),
|
||||
'render_callback' => 'render_block_core_latest_posts',
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user