woo_widget_cssclass = 'woocommerce widget_layered_nav_filters'; $this->woo_widget_description = __( 'Shows active layered nav filters so users can see and deactivate them.', 'woocommerce' ); $this->woo_widget_idbase = 'woocommerce_layered_nav_filters'; $this->woo_widget_name = __( 'WooCommerce Layered Nav Filters', 'woocommerce' ); /* Widget settings. */ $widget_ops = array( 'classname' => $this->woo_widget_cssclass, 'description' => $this->woo_widget_description ); /* Create the widget. */ $this->WP_Widget( 'woocommerce_layered_nav_filters', $this->woo_widget_name, $widget_ops ); } /** * widget function. * * @see WP_Widget * @access public * @param array $args * @param array $instance * @return void */ function widget( $args, $instance ) { global $_chosen_attributes, $woocommerce, $_attributes_array; extract( $args ); if ( ! is_post_type_archive( 'product' ) && is_array( $_attributes_array ) && ! is_tax( array_merge( $_attributes_array, array( 'product_cat', 'product_tag' ) ) ) ) return; $current_term = $_attributes_array && is_tax( $_attributes_array ) ? get_queried_object()->term_id : ''; $current_tax = $_attributes_array && is_tax( $_attributes_array ) ? get_queried_object()->taxonomy : ''; $title = ( ! isset( $instance['title'] ) ) ? __( 'Active filters', 'woocommerce' ) : $instance['title']; $title = apply_filters( 'widget_title', $title, $instance, $this->id_base); // 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 ( count( $_chosen_attributes ) > 0 || $min_price > 0 || $max_price > 0 ) { echo $before_widget; if ( $title ) { echo $before_title . $title . $after_title; } echo "