Ticket #63531: 63531.diff
| File 63531.diff, 2.3 KB (added by , 8 months ago) |
|---|
-
src/wp-includes/blocks/categories.php
50 50 $show_label = empty( $attributes['showLabel'] ) ? ' screen-reader-text' : ''; 51 51 $default_label = $taxonomy->label; 52 52 $label_text = ! empty( $attributes['label'] ) ? wp_kses_post( $attributes['label'] ) : $default_label; 53 $wrapper_markup = '<div %1$s>< label class="wp-block-categories__label' . $show_label . '" for="' . esc_attr( $id ) . '">' . $label_text . '</label>%2$s</div>';53 $wrapper_markup = '<div %1$s><form action="' . esc_url( home_url() ) . '" method="get"><label class="wp-block-categories__label' . $show_label . '" for="' . esc_attr( $id ) . '">' . $label_text . '</label>%2$s<button type="submit">' . esc_html__( 'View' ) . '</button></form></div>'; 54 54 $items_markup = wp_dropdown_categories( $args ); 55 55 $type = 'dropdown'; 56 57 if ( ! is_admin() ) {58 // Inject the dropdown script immediately after the select dropdown.59 $items_markup = preg_replace(60 '#(?<=</select>)#',61 build_dropdown_script_block_core_categories( $id ),62 $items_markup,63 164 );65 }66 56 } else { 67 57 $args['show_option_none'] = $taxonomy->labels->no_terms; 68 58 -
src/wp-includes/widgets/class-wp-widget-categories.php
90 90 */ 91 91 wp_dropdown_categories( apply_filters( 'widget_categories_dropdown_args', $cat_args, $instance ) ); 92 92 93 echo '<button type="submit">' . esc_html__( 'View' ) . '</button>'; 93 94 echo '</form>'; 94 95 95 ob_start();96 ?>97 98 <script>99 (function() {100 var dropdown = document.getElementById( "<?php echo esc_js( $dropdown_id ); ?>" );101 function onCatChange() {102 if ( dropdown.options[ dropdown.selectedIndex ].value > 0 ) {103 dropdown.parentNode.submit();104 }105 }106 dropdown.onchange = onCatChange;107 })();108 </script>109 110 <?php111 wp_print_inline_script_tag( wp_remove_surrounding_empty_script_tags( ob_get_clean() ) );112 96 } else { 113 97 $format = current_theme_supports( 'html5', 'navigation-widgets' ) ? 'html5' : 'xhtml'; 114 98