widget_cssclass = 'woocommerce widget_layered_nav_filters'; $this->widget_description = __( 'Shows active layered nav filters so users can see and deactivate them.', 'woocommerce' ); $this->widget_id = 'woocommerce_layered_nav_filters'; $this->widget_name = __( 'WooCommerce layered nav filters', 'woocommerce' ); $this->settings = array( 'title' => array( 'type' => 'text', 'std' => __( 'Active filters', 'woocommerce' ), 'label' => __( 'Title', 'woocommerce' ), ), ); parent::__construct(); } /** * Output widget. * * @see WP_Widget * * @param array $args * @param array $instance */ public function widget( $args, $instance ) { if ( ! is_post_type_archive( 'product' ) && ! is_tax( get_object_taxonomies( 'product' ) ) ) { return; } $_chosen_attributes = WC_Query::get_layered_nav_chosen_attributes(); $min_price = isset( $_GET['min_price'] ) ? wc_clean( $_GET['min_price'] ) : 0; $max_price = isset( $_GET['max_price'] ) ? wc_clean( $_GET['max_price'] ) : 0; $min_rating = isset( $_GET['min_rating'] ) ? absint( $_GET['min_rating'] ) : 0; if ( 0 < count( $_chosen_attributes ) || 0 < $min_price || 0 < $max_price || 0 < $min_rating ) { $this->widget_start( $args, $instance ); echo ''; $this->widget_end( $args ); } } }