equal
deleted
inserted
replaced
11 * @param array $attributes The block attributes. |
11 * @param array $attributes The block attributes. |
12 * |
12 * |
13 * @return string Returns the tag cloud for selected taxonomy. |
13 * @return string Returns the tag cloud for selected taxonomy. |
14 */ |
14 */ |
15 function render_block_core_tag_cloud( $attributes ) { |
15 function render_block_core_tag_cloud( $attributes ) { |
16 $class = isset( $attributes['align'] ) ? |
16 $args = array( |
17 "wp-block-tag-cloud align{$attributes['align']}" : |
|
18 'wp-block-tag-cloud'; |
|
19 |
|
20 if ( isset( $attributes['className'] ) ) { |
|
21 $class .= ' ' . $attributes['className']; |
|
22 } |
|
23 |
|
24 $args = array( |
|
25 'echo' => false, |
17 'echo' => false, |
26 'taxonomy' => $attributes['taxonomy'], |
18 'taxonomy' => $attributes['taxonomy'], |
27 'show_count' => $attributes['showTagCounts'], |
19 'show_count' => $attributes['showTagCounts'], |
28 ); |
20 ); |
29 |
|
30 $tag_cloud = wp_tag_cloud( $args ); |
21 $tag_cloud = wp_tag_cloud( $args ); |
31 |
22 |
32 if ( ! $tag_cloud ) { |
23 if ( ! $tag_cloud ) { |
33 $labels = get_taxonomy_labels( get_taxonomy( $attributes['taxonomy'] ) ); |
24 $labels = get_taxonomy_labels( get_taxonomy( $attributes['taxonomy'] ) ); |
34 $tag_cloud = esc_html( |
25 $tag_cloud = esc_html( |
38 strtolower( $labels->name ) |
29 strtolower( $labels->name ) |
39 ) |
30 ) |
40 ); |
31 ); |
41 } |
32 } |
42 |
33 |
|
34 $wrapper_attributes = get_block_wrapper_attributes(); |
|
35 |
43 return sprintf( |
36 return sprintf( |
44 '<p class="%1$s">%2$s</p>', |
37 '<p %1$s>%2$s</p>', |
45 esc_attr( $class ), |
38 $wrapper_attributes, |
46 $tag_cloud |
39 $tag_cloud |
47 ); |
40 ); |
48 } |
41 } |
49 |
42 |
50 /** |
43 /** |