PluginProbe
Gutenberg / 14.5.2
Gutenberg v14.5.2
24.0.0 23.9.1 23.9.0 23.8.0 23.7.2 23.7.1 23.7.0 23.6.1 23.6.2 23.6.0 23.5.3 23.5.2 23.5.1 23.5.0 23.4.0 23.3.2 23.3.1 23.3.0 23.2.0 23.2.1 23.2.2 23.1.1 23.1.0 23.0.1 12.6.0 All 403 releases
← All changes | build/block-library/blocks/latest-posts.php +13 -7 12.6.0 → 14.5.2 View file →
@@ -36,13 +36,14 @@
36 36 function gutenberg_render_block_core_latest_posts( $attributes ) {
37 37 global $post, $block_core_latest_posts_excerpt_length;
38 38
39 39 $args = array(
40 - 'posts_per_page' => $attributes['postsToShow'],
41 - 'post_status' => 'publish',
42 - 'order' => $attributes['order'],
43 - 'orderby' => $attributes['orderBy'],
44 - 'suppress_filters' => false,
40 + 'posts_per_page' => $attributes['postsToShow'],
41 + 'post_status' => 'publish',
42 + 'order' => $attributes['order'],
43 + 'orderby' => $attributes['orderBy'],
44 + 'ignore_sticky_posts' => true,
45 + 'no_found_rows' => true,
45 46 );
46 47
47 48 $block_core_latest_posts_excerpt_length = $attributes['excerptLength'];
48 49 add_filter( 'excerpt_length', 'gutenberg_block_core_latest_posts_get_excerpt_length', 20 );
@@ -53,10 +54,15 @@
53 54 if ( isset( $attributes['selectedAuthor'] ) ) {
54 55 $args['author'] = $attributes['selectedAuthor'];
55 56 }
56 57
57 - $recent_posts = get_posts( $args );
58 + $query = new WP_Query();
59 + $recent_posts = $query->query( $args );
58 60
61 + if ( isset( $attributes['displayFeaturedImage'] ) && $attributes['displayFeaturedImage'] ) {
62 + update_post_thumbnail_cache( $query );
63 + }
64 +
59 65 $list_items_markup = '';
60 66
61 67 foreach ( $recent_posts as $post ) {
62 68 $post_link = esc_url( get_permalink( $post ) );
@@ -104,9 +110,9 @@
104 110 );
105 111 }
106 112
107 113 $list_items_markup .= sprintf(
108 - '<a href="%1$s">%2$s</a>',
114 + '<a class="wp-block-latest-posts__post-title" href="%1$s">%2$s</a>',
109 115 esc_url( $post_link ),
110 116 $title
111 117 );
112 118