Changeset 53157 for trunk/src/wp-includes/blocks/archives.php
- Timestamp:
- 04/12/2022 03:10:30 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/blocks/archives.php
r52042 r53157 17 17 function render_block_core_archives( $attributes ) { 18 18 $show_post_count = ! empty( $attributes['showPostCounts'] ); 19 20 $class = '';19 $type = isset( $attributes['type'] ) ? $attributes['type'] : 'monthly'; 20 $class = ''; 21 21 22 22 if ( ! empty( $attributes['displayAsDropdown'] ) ) { … … 24 24 $class .= ' wp-block-archives-dropdown'; 25 25 26 $dropdown_id = esc_attr( uniqid( 'wp-block-archives-' ));26 $dropdown_id = wp_unique_id( 'wp-block-archives-' ); 27 27 $title = __( 'Archives' ); 28 28 … … 31 31 'widget_archives_dropdown_args', 32 32 array( 33 'type' => 'monthly',33 'type' => $type, 34 34 'format' => 'option', 35 35 'show_post_count' => $show_post_count, … … 63 63 } 64 64 65 $label = esc_html( $label ); 66 67 $block_content = '<label for="' . $dropdown_id . '">' . $title . '</label> 68 <select id="' . $dropdown_id . '" name="archive-dropdown" onchange="document.location.href=this.options[this.selectedIndex].value;"> 69 <option value="">' . $label . '</option>' . $archives . '</select>'; 65 $block_content = '<label for="' . esc_attr( $dropdown_id ) . '">' . esc_html( $title ) . '</label> 66 <select id="' . esc_attr( $dropdown_id ) . '" name="archive-dropdown" onchange="document.location.href=this.options[this.selectedIndex].value;"> 67 <option value="">' . esc_html( $label ) . '</option>' . $archives . '</select>'; 70 68 71 69 return sprintf( … … 82 80 'widget_archives_args', 83 81 array( 84 'type' => 'monthly',82 'type' => $type, 85 83 'show_post_count' => $show_post_count, 86 84 ) … … 91 89 $archives = wp_get_archives( $archives_args ); 92 90 93 $classnames = esc_attr( $class ); 94 95 $wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $classnames ) ); 91 $wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $class ) ); 96 92 97 93 if ( empty( $archives ) ) {
Note: See TracChangeset
for help on using the changeset viewer.