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(); } /** * widget function. * * @see WP_Widget * * @param array $args * @param array $instance * * @return void */ public function widget( $args, $instance ) { global $_chosen_attributes; if ( ! is_post_type_archive( 'product' ) && ! is_tax( get_object_taxonomies( 'product' ) ) ) { return; } // Price $min_price = isset( $_GET['min_price'] ) ? esc_attr( $_GET['min_price'] ) : 0; $max_price = isset( $_GET['max_price'] ) ? esc_attr( $_GET['max_price'] ) : 0; if ( 0 < count( $_chosen_attributes ) || 0 < $min_price || 0 < $max_price ) { $this->widget_start( $args, $instance ); echo ''; $this->widget_end( $args ); } } } register_widget( 'WC_Widget_Layered_Nav_Filters' );