woocommerce/classes/widgets/class-wc-widget-product-sea...

60 lines
1.3 KiB
PHP
Raw Normal View History

2011-08-10 17:11:11 +00:00
<?php
/**
* Product Search Widget
2012-08-14 17:37:50 +00:00
*
* @author WooThemes
* @category Widgets
* @package WooCommerce/Widgets
* @version 2.1.0
* @extends WC_Widget
2011-08-10 17:11:11 +00:00
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
class WC_Widget_Product_Search extends WC_Widget {
2012-08-14 17:37:50 +00:00
/**
* Constructor
2012-08-14 17:37:50 +00:00
*/
public function __construct() {
$this->widget_cssclass = 'woocommerce widget_product_search';
$this->widget_description = __( 'A Search box for products only.', 'woocommerce' );
$this->widget_id = 'woocommerce_product_search';
$this->widget_name = __( 'WooCommerce Product Search', 'woocommerce' );
$this->settings = array(
'title' => array(
'type' => 'text',
'std' => __( 'Search Products', 'woocommerce' ),
'label' => __( 'Title', 'woocommerce' )
)
);
parent::__construct();
2011-08-10 17:11:11 +00:00
}
2012-08-14 17:37:50 +00:00
/**
* widget function.
*
* @see WP_Widget
* @access public
* @param array $args
* @param array $instance
* @return void
*/
2011-08-10 17:11:11 +00:00
function widget( $args, $instance ) {
extract( $args );
2011-08-10 17:11:11 +00:00
$title = $instance['title'];
$title = apply_filters('widget_title', $title, $instance, $this->id_base);
2012-08-14 17:37:50 +00:00
2011-08-10 17:11:11 +00:00
echo $before_widget;
2012-08-14 17:37:50 +00:00
if ( $title )
echo $before_title . $title . $after_title;
2012-08-14 17:37:50 +00:00
2012-04-16 13:32:58 +00:00
get_product_search_form();
2012-08-14 17:37:50 +00:00
2011-08-10 17:11:11 +00:00
echo $after_widget;
}
}
2011-08-10 17:11:11 +00:00
register_widget( 'WC_Widget_Product_Search' );