From fea7dec04c5f94c00f4278206b4a7a8eb237db97 Mon Sep 17 00:00:00 2001 From: Dean Sas Date: Mon, 25 Apr 2022 10:32:42 +0100 Subject: [PATCH] Post terms: Wrap prefix & suffix in spans If the prefix or suffix attributes are provided, wrap them in spans with a classname. See #40559 --- packages/block-library/src/post-terms/index.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/packages/block-library/src/post-terms/index.php b/packages/block-library/src/post-terms/index.php index 3cf18f653a8e8a..16aa9c97e85084 100644 --- a/packages/block-library/src/post-terms/index.php +++ b/packages/block-library/src/post-terms/index.php @@ -36,12 +36,22 @@ function render_block_core_post_terms( $attributes, $content, $block ) { $wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $classes ) ); + $prefix = "
"; + if ( isset( $attributes['prefix'] ) && $attributes['prefix'] ) { + $prefix .= '' . $attributes['prefix'] . ''; + } + + $suffix = '
'; + if ( isset( $attributes['suffix'] ) && $attributes['suffix'] ) { + $suffix = '' . $attributes['suffix'] . $suffix; + } + return get_the_term_list( $block->context['postId'], $attributes['term'], - "
" . ( isset( $attributes['prefix'] ) ? $attributes['prefix'] : '' ), + $prefix, '' . esc_html( $separator ) . '', - ( isset( $attributes['suffix'] ) ? $attributes['suffix'] : '' ) . '
' + $suffix ); }