Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[LatestPosts] Fixes the excerpt length #20313

Merged
merged 7 commits into from
Mar 2, 2020
6 changes: 6 additions & 0 deletions packages/block-library/src/latest-posts/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ function render_block_core_latest_posts( $attributes ) {
'suppress_filters' => false,
);

$excerpt_length = $attributes['excerptLength'];
$excerpt_length_filter = function ( $length ) use ( $excerpt_length ) {
return $excerpt_length;
};
add_filter( 'excerpt_length', $excerpt_length_filter, 999 );
draganescu marked this conversation as resolved.
Show resolved Hide resolved

if ( isset( $attributes['categories'] ) ) {
$args['category'] = $attributes['categories'];
}
Expand Down