Edit File by line
/home/zeestwma/richards.../wp-inclu.../blocks
File: post-author-biography.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* Server-side rendering of the `core/post-author-biography` block.
[2] Fix | Delete
*
[3] Fix | Delete
* @package WordPress
[4] Fix | Delete
*/
[5] Fix | Delete
[6] Fix | Delete
/**
[7] Fix | Delete
* Renders the `core/post-author-biography` 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 rendered post author biography block.
[15] Fix | Delete
*/
[16] Fix | Delete
function render_block_core_post_author_biography( $attributes, $content, $block ) {
[17] Fix | Delete
if ( isset( $block->context['postId'] ) ) {
[18] Fix | Delete
$author_id = get_post_field( 'post_author', $block->context['postId'] );
[19] Fix | Delete
} else {
[20] Fix | Delete
$author_id = get_query_var( 'author' );
[21] Fix | Delete
}
[22] Fix | Delete
[23] Fix | Delete
if ( empty( $author_id ) ) {
[24] Fix | Delete
return '';
[25] Fix | Delete
}
[26] Fix | Delete
[27] Fix | Delete
$author_biography = get_the_author_meta( 'description', $author_id );
[28] Fix | Delete
if ( empty( $author_biography ) ) {
[29] Fix | Delete
return '';
[30] Fix | Delete
}
[31] Fix | Delete
[32] Fix | Delete
$align_class_name = empty( $attributes['textAlign'] ) ? '' : "has-text-align-{$attributes['textAlign']}";
[33] Fix | Delete
$wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $align_class_name ) );
[34] Fix | Delete
[35] Fix | Delete
return sprintf( '<div %1$s>', $wrapper_attributes ) . $author_biography . '</div>';
[36] Fix | Delete
}
[37] Fix | Delete
[38] Fix | Delete
/**
[39] Fix | Delete
* Registers the `core/post-author-biography` block on the server.
[40] Fix | Delete
*
[41] Fix | Delete
* @since 6.0.0
[42] Fix | Delete
*/
[43] Fix | Delete
function register_block_core_post_author_biography() {
[44] Fix | Delete
register_block_type_from_metadata(
[45] Fix | Delete
__DIR__ . '/post-author-biography',
[46] Fix | Delete
array(
[47] Fix | Delete
'render_callback' => 'render_block_core_post_author_biography',
[48] Fix | Delete
)
[49] Fix | Delete
);
[50] Fix | Delete
}
[51] Fix | Delete
add_action( 'init', 'register_block_core_post_author_biography' );
[52] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function