Edit File by line
/home/zeestwma/redstone.../wp-inclu.../blocks
File: term-description.php
<?php
[0] Fix | Delete
/**
[1] Fix | Delete
* Server-side rendering of the `core/term-description` block.
[2] Fix | Delete
*
[3] Fix | Delete
* @package WordPress
[4] Fix | Delete
*/
[5] Fix | Delete
[6] Fix | Delete
/**
[7] Fix | Delete
* Renders the `core/term-description` block on the server.
[8] Fix | Delete
*
[9] Fix | Delete
* @since 5.9.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
*
[15] Fix | Delete
* @return string Returns the description of the current taxonomy term, if available
[16] Fix | Delete
*/
[17] Fix | Delete
function render_block_core_term_description( $attributes, $content, $block ) {
[18] Fix | Delete
$term_description = '';
[19] Fix | Delete
[20] Fix | Delete
// Get term from context or from the current query.
[21] Fix | Delete
if ( isset( $block->context['termId'] ) && isset( $block->context['taxonomy'] ) ) {
[22] Fix | Delete
$term = get_term( $block->context['termId'], $block->context['taxonomy'] );
[23] Fix | Delete
if ( $term && ! is_wp_error( $term ) ) {
[24] Fix | Delete
$term_description = $term->description;
[25] Fix | Delete
}
[26] Fix | Delete
} elseif ( is_category() || is_tag() || is_tax() ) {
[27] Fix | Delete
$term_description = term_description();
[28] Fix | Delete
}
[29] Fix | Delete
[30] Fix | Delete
if ( empty( $term_description ) ) {
[31] Fix | Delete
return '';
[32] Fix | Delete
}
[33] Fix | Delete
[34] Fix | Delete
$classes = array();
[35] Fix | Delete
if ( isset( $attributes['textAlign'] ) ) {
[36] Fix | Delete
$classes[] = 'has-text-align-' . $attributes['textAlign'];
[37] Fix | Delete
}
[38] Fix | Delete
if ( isset( $attributes['style']['elements']['link']['color']['text'] ) ) {
[39] Fix | Delete
$classes[] = 'has-link-color';
[40] Fix | Delete
}
[41] Fix | Delete
$wrapper_attributes = get_block_wrapper_attributes( array( 'class' => implode( ' ', $classes ) ) );
[42] Fix | Delete
[43] Fix | Delete
return '<div ' . $wrapper_attributes . '>' . $term_description . '</div>';
[44] Fix | Delete
}
[45] Fix | Delete
[46] Fix | Delete
/**
[47] Fix | Delete
* Registers the `core/term-description` block on the server.
[48] Fix | Delete
*
[49] Fix | Delete
* @since 5.9.0
[50] Fix | Delete
*/
[51] Fix | Delete
function register_block_core_term_description() {
[52] Fix | Delete
register_block_type_from_metadata(
[53] Fix | Delete
__DIR__ . '/term-description',
[54] Fix | Delete
array(
[55] Fix | Delete
'render_callback' => 'render_block_core_term_description',
[56] Fix | Delete
)
[57] Fix | Delete
);
[58] Fix | Delete
}
[59] Fix | Delete
add_action( 'init', 'register_block_core_term_description' );
[60] Fix | Delete
[61] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function