summaryrefslogtreecommitdiffstats
path: root/wp-includes/blocks/latest-posts.php
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--wp-includes/blocks/latest-posts.php11
1 files changed, 10 insertions, 1 deletions
diff --git a/wp-includes/blocks/latest-posts.php b/wp-includes/blocks/latest-posts.php
index adc51d0..85c7b58 100644
--- a/wp-includes/blocks/latest-posts.php
+++ b/wp-includes/blocks/latest-posts.php
@@ -18,6 +18,8 @@ $block_core_latest_posts_excerpt_length = 0;
* Callback for the excerpt_length filter used by
* the Latest Posts block at render time.
*
+ * @since 5.4.0
+ *
* @return int Returns the global $block_core_latest_posts_excerpt_length variable
* to allow the excerpt_length filter respect the Latest Block setting.
*/
@@ -29,6 +31,8 @@ function block_core_latest_posts_get_excerpt_length() {
/**
* Renders the `core/latest-posts` block on server.
*
+ * @since 5.0.0
+ *
* @param array $attributes The block attributes.
*
* @return string Returns the post content with latest posts added.
@@ -148,12 +152,13 @@ function render_block_core_latest_posts( $attributes ) {
* […] is the default excerpt ending from wp_trim_excerpt() in Core.
*/
if ( str_ends_with( $trimmed_excerpt, ' […]' ) ) {
+ /** This filter is documented in wp-includes/formatting.php */
$excerpt_length = (int) apply_filters( 'excerpt_length', $block_core_latest_posts_excerpt_length );
if ( $excerpt_length <= $block_core_latest_posts_excerpt_length ) {
$trimmed_excerpt = substr( $trimmed_excerpt, 0, -11 );
$trimmed_excerpt .= sprintf(
/* translators: 1: A URL to a post, 2: Hidden accessibility text: Post title */
- __( '… <a href="%1$s" rel="noopener noreferrer">Read more<span class="screen-reader-text">: %2$s</span></a>' ),
+ __( '… <a class="wp-block-latest-posts__read-more" href="%1$s" rel="noopener noreferrer">Read more<span class="screen-reader-text">: %2$s</span></a>' ),
esc_url( $post_link ),
esc_html( $title )
);
@@ -218,6 +223,8 @@ function render_block_core_latest_posts( $attributes ) {
/**
* Registers the `core/latest-posts` block on server.
+ *
+ * @since 5.0.0
*/
function register_block_core_latest_posts() {
register_block_type_from_metadata(
@@ -241,6 +248,8 @@ add_action( 'init', 'register_block_core_latest_posts' );
* TODO: Remove when and if the bottom client-side deprecation for this block
* is removed.
*
+ * @since 5.5.0
+ *
* @param array $block A single parsed block object.
*
* @return array The migrated block object.