Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/clone/wp-inclu.../blocks
File: post-author-name.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* Server-side rendering of the `core/post-author-name` 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-name` block on the server.
[8] Fix | Delete
*
[9] Fix | Delete
* @since 6.2.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 name block.
[15] Fix | Delete
*/
[16] Fix | Delete
function render_block_core_post_author_name( $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_name = get_the_author_meta( 'display_name', $author_id );
[28] Fix | Delete
if ( isset( $attributes['isLink'] ) && $attributes['isLink'] ) {
[29] Fix | Delete
$author_name = sprintf( '<a href="%1$s" target="%2$s" class="wp-block-post-author-name__link">%3$s</a>', get_author_posts_url( $author_id ), esc_attr( $attributes['linkTarget'] ), $author_name );
[30] Fix | Delete
}
[31] Fix | Delete
[32] Fix | Delete
$classes = array();
[33] Fix | Delete
if ( isset( $attributes['textAlign'] ) ) {
[34] Fix | Delete
$classes[] = 'has-text-align-' . $attributes['textAlign'];
[35] Fix | Delete
}
[36] Fix | Delete
if ( isset( $attributes['style']['elements']['link']['color']['text'] ) ) {
[37] Fix | Delete
$classes[] = 'has-link-color';
[38] Fix | Delete
}
[39] Fix | Delete
$wrapper_attributes = get_block_wrapper_attributes( array( 'class' => implode( ' ', $classes ) ) );
[40] Fix | Delete
[41] Fix | Delete
return sprintf( '<div %1$s>%2$s</div>', $wrapper_attributes, $author_name );
[42] Fix | Delete
}
[43] Fix | Delete
[44] Fix | Delete
/**
[45] Fix | Delete
* Registers the `core/post-author-name` block on the server.
[46] Fix | Delete
*
[47] Fix | Delete
* @since 6.2.0
[48] Fix | Delete
*/
[49] Fix | Delete
function register_block_core_post_author_name() {
[50] Fix | Delete
register_block_type_from_metadata(
[51] Fix | Delete
__DIR__ . '/post-author-name',
[52] Fix | Delete
array(
[53] Fix | Delete
'render_callback' => 'render_block_core_post_author_name',
[54] Fix | Delete
)
[55] Fix | Delete
);
[56] Fix | Delete
}
[57] Fix | Delete
add_action( 'init', 'register_block_core_post_author_name' );
[58] Fix | Delete
[59] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function