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 $smallest_font_size = $attributes['smallestFontSize']; |
|
17 $unit = ( preg_match( '/^[0-9.]+(?P<unit>[a-z%]+)$/i', $smallest_font_size, $m ) ? $m['unit'] : 'pt' ); |
|
18 |
16 $args = array( |
19 $args = array( |
17 'echo' => false, |
20 'echo' => false, |
|
21 'unit' => $unit, |
18 'taxonomy' => $attributes['taxonomy'], |
22 'taxonomy' => $attributes['taxonomy'], |
19 'show_count' => $attributes['showTagCounts'], |
23 'show_count' => $attributes['showTagCounts'], |
|
24 'number' => $attributes['numberOfTags'], |
|
25 'smallest' => floatVal( $attributes['smallestFontSize'] ), |
|
26 'largest' => floatVal( $attributes['largestFontSize'] ), |
20 ); |
27 ); |
21 $tag_cloud = wp_tag_cloud( $args ); |
28 $tag_cloud = wp_tag_cloud( $args ); |
22 |
29 |
23 if ( ! $tag_cloud ) { |
30 if ( ! $tag_cloud ) { |
24 $labels = get_taxonomy_labels( get_taxonomy( $attributes['taxonomy'] ) ); |
31 $labels = get_taxonomy_labels( get_taxonomy( $attributes['taxonomy'] ) ); |