. * And the dropdown is now filtered with 'wp_dropdown_cats.' * This enables adding an 'on' attribute, with the id of the form. * So changing the dropdown value will redirect to the category page, with valid AMP. * * @since 0.7.0 * * @param array $args Widget display data. * @param array $instance Data for widget. * @return void */ public function widget( $args, $instance ) { if ( ! amp_is_request() ) { parent::widget( $args, $instance ); return; } static $first_dropdown = true; $title = ! empty( $instance['title'] ) ? $instance['title'] : __( 'Categories', 'default' ); /** This filter is documented in wp-includes/widgets/class-wp-widget-pages.php */ $title = apply_filters( 'widget_title', $title, $instance, $this->id_base ); $c = ! empty( $instance['count'] ) ? '1' : '0'; $h = ! empty( $instance['hierarchical'] ) ? '1' : '0'; $d = ! empty( $instance['dropdown'] ) ? '1' : '0'; echo wp_kses_post( $args['before_widget'] ); if ( $title ) { echo wp_kses_post( $args['before_title'] . $title . $args['after_title'] ); } $cat_args = [ 'orderby' => 'name', 'show_count' => $c, 'hierarchical' => $h, ]; if ( $d ) : $form_id = sprintf( 'widget-categories-dropdown-%d', $this->number ); printf( '