Edit File by line
/home/zeestwma/richards.../wp-inclu.../blocks
File: read-more.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* Server-side rendering of the `core/read-more` block.
[2] Fix | Delete
*
[3] Fix | Delete
* @package WordPress
[4] Fix | Delete
*/
[5] Fix | Delete
[6] Fix | Delete
/**
[7] Fix | Delete
* Renders the `core/read-more` block on the server.
[8] Fix | Delete
*
[9] Fix | Delete
* @since 6.0.0
[10] Fix | Delete
*
[11] Fix | Delete
* @param array $attributes Block attributes.
[12] Fix | Delete
* @param string $content Block default content.
[13] Fix | Delete
* @param WP_Block $block Block instance.
[14] Fix | Delete
* @return string Returns the post link.
[15] Fix | Delete
*/
[16] Fix | Delete
function render_block_core_read_more( $attributes, $content, $block ) {
[17] Fix | Delete
if ( ! isset( $block->context['postId'] ) ) {
[18] Fix | Delete
return '';
[19] Fix | Delete
}
[20] Fix | Delete
[21] Fix | Delete
$post_ID = $block->context['postId'];
[22] Fix | Delete
$post_title = get_the_title( $post_ID );
[23] Fix | Delete
if ( '' === $post_title ) {
[24] Fix | Delete
$post_title = sprintf(
[25] Fix | Delete
/* translators: %s is post ID to describe the link for screen readers. */
[26] Fix | Delete
__( 'untitled post %s' ),
[27] Fix | Delete
$post_ID
[28] Fix | Delete
);
[29] Fix | Delete
}
[30] Fix | Delete
$screen_reader_text = sprintf(
[31] Fix | Delete
/* translators: %s is either the post title or post ID to describe the link for screen readers. */
[32] Fix | Delete
__( ': %s' ),
[33] Fix | Delete
$post_title
[34] Fix | Delete
);
[35] Fix | Delete
$justify_class_name = empty( $attributes['justifyContent'] ) ? '' : "is-justified-{$attributes['justifyContent']}";
[36] Fix | Delete
$wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $justify_class_name ) );
[37] Fix | Delete
$more_text = ! empty( $attributes['content'] ) ? wp_kses_post( $attributes['content'] ) : __( 'Read more' );
[38] Fix | Delete
return sprintf(
[39] Fix | Delete
'<a %1s href="%2s" target="%3s">%4s<span class="screen-reader-text">%5s</span></a>',
[40] Fix | Delete
$wrapper_attributes,
[41] Fix | Delete
get_the_permalink( $post_ID ),
[42] Fix | Delete
esc_attr( $attributes['linkTarget'] ),
[43] Fix | Delete
$more_text,
[44] Fix | Delete
$screen_reader_text
[45] Fix | Delete
);
[46] Fix | Delete
}
[47] Fix | Delete
[48] Fix | Delete
/**
[49] Fix | Delete
* Registers the `core/read-more` block on the server.
[50] Fix | Delete
*
[51] Fix | Delete
* @since 6.0.0
[52] Fix | Delete
*/
[53] Fix | Delete
function register_block_core_read_more() {
[54] Fix | Delete
register_block_type_from_metadata(
[55] Fix | Delete
__DIR__ . '/read-more',
[56] Fix | Delete
array(
[57] Fix | Delete
'render_callback' => 'render_block_core_read_more',
[58] Fix | Delete
)
[59] Fix | Delete
);
[60] Fix | Delete
}
[61] Fix | Delete
add_action( 'init', 'register_block_core_read_more' );
[62] Fix | Delete
[63] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function