context['filterwell/queryId'] ) ) { return; } $qlf_prefix = FilterWell::prefix( $block->context['filterwell/queryId'], ! empty( $block->context['filterwell/inherit'] ) ); $qlf_request = FilterWell::get_request( $qlf_prefix ); $qlf_chips = array(); if ( '' !== $qlf_request['s'] ) { $qlf_chips[] = array( /* translators: %s: search text */ 'label' => sprintf( __( 'Search: %s', 'filterwell' ), $qlf_request['s'] ), 'name' => $qlf_prefix . '_s', 'value' => $qlf_request['s'], ); } foreach ( $qlf_request['tax'] as $qlf_taxonomy => $qlf_filter ) { // El término del archivo (p. ej. /category/diseno/) es la página, no un filtro que se pueda quitar. if ( ! empty( $qlf_filter['archive'] ) ) { continue; } $qlf_is_author = FilterWell::AUTHOR === $qlf_taxonomy; $qlf_tax_label = $qlf_is_author ? __( 'Author', 'filterwell' ) : get_taxonomy( $qlf_taxonomy )->labels->singular_name; foreach ( $qlf_filter['terms'] as $qlf_slug ) { $qlf_user = $qlf_is_author ? get_user_by( 'slug', $qlf_slug ) : null; $qlf_term = $qlf_is_author ? ( $qlf_user ? FilterWell::author_as_term( $qlf_user ) : null ) : get_term_by( 'slug', $qlf_slug, $qlf_taxonomy ); if ( $qlf_term ) { $qlf_chips[] = array( /* translators: 1: taxonomy name, 2: term name */ 'label' => sprintf( __( '%1$s: %2$s', 'filterwell' ), $qlf_tax_label, $qlf_term->name ), 'name' => $qlf_filter['param'], 'value' => $qlf_slug, ); } } } // Rango de fechas. foreach ( array( /* translators: %s: start date of the range */ 'from' => __( 'From: %s', 'filterwell' ), /* translators: %s: end date of the range */ 'to' => __( 'To: %s', 'filterwell' ), ) as $qlf_edge => $qlf_format ) { // El período de un archivo por fecha es la página, no un filtro que se pueda quitar. if ( $qlf_request[ $qlf_edge ] && ! $qlf_request['date_archive'] ) { $qlf_chips[] = array( 'label' => sprintf( $qlf_format, date_i18n( get_option( 'date_format' ), strtotime( $qlf_request[ $qlf_edge ] ) ) ), 'name' => $qlf_prefix . '_' . $qlf_edge, 'value' => $qlf_request[ $qlf_edge ], ); } } // Botón "Limpiar filtros": se renderiza como un bloque Botón real con el estilo // "Contorno", así usa los estilos de botón de la guía de estilos del tema. $qlf_clear_button = ''; if ( $qlf_chips && ! empty( $attributes['showClearButton'] ) ) { $qlf_clear_button = do_blocks( sprintf( '
', esc_html( FilterWell::text( $attributes, 'clearButtonText', __( 'Clear filters', 'filterwell' ) ) ) ) ); $qlf_processor = new WP_HTML_Tag_Processor( $qlf_clear_button ); if ( $qlf_processor->next_tag( 'button' ) ) { $qlf_processor->set_attribute( 'data-wp-on--click', 'actions.reset' ); $qlf_clear_button = $qlf_processor->get_updated_html(); } } $qlf_wrapper = get_block_wrapper_attributes( array( 'data-wp-interactive' => 'filterwell', 'data-wp-router-region' => FilterWell::region_id( 'qlf-active-' . $qlf_prefix ), ) ); ?>