Skip to content

Commit

Permalink
Handle 'No tags' message on public side based on block property
Browse files Browse the repository at this point in the history
  • Loading branch information
n2erjo00 committed Oct 28, 2023
1 parent b567b2b commit df4a393
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion packages/block-library/src/post-terms/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,12 @@ function render_block_core_post_terms( $attributes, $content, $block ) {

$post_terms = get_the_terms( $block->context['postId'], $attributes['term'] );
if ( is_wp_error( $post_terms ) || empty( $post_terms ) ) {
return '';
if ( ! $attributes['showTermNoResults'] ) {
return '';
}
$tax = get_taxonomy( $attributes['term'] );

Check warning on line 30 in packages/block-library/src/post-terms/index.php

View workflow job for this annotation

GitHub Actions / PHP coding standards

Equals sign not aligned with surrounding assignments; expected 4 spaces but found 1 space
$labels = get_taxonomy_labels( $tax );
return '<div class="taxonomy-' . $attributes['term'] . ' wp-block-post-terms">' . esc_html( $labels->no_terms ) . '</div>';
}

$classes = array( 'taxonomy-' . $attributes['term'] );
Expand Down

0 comments on commit df4a393

Please sign in to comment.