1 <?php
 2 /**
 3  * Product Search Widget
 4  *
 5  * @author      WooThemes
 6  * @category    Widgets
 7  * @package     WooCommerce/Widgets
 8  * @version     2.1.0
 9  * @extends     WC_Widget
10  */
11 
12 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
13 
14 class WC_Widget_Product_Search extends WC_Widget {
15 
16     /**
17      * Constructor
18      */
19     public function __construct() {
20         $this->widget_cssclass    = 'woocommerce widget_product_search';
21         $this->widget_description = __( 'A Search box for products only.', 'woocommerce' );
22         $this->widget_id          = 'woocommerce_product_search';
23         $this->widget_name        = __( 'WooCommerce Product Search', 'woocommerce' );
24         $this->settings           = array(
25             'title'  => array(
26                 'type'  => 'text',
27                 'std'   => __( 'Search Products', 'woocommerce' ),
28                 'label' => __( 'Title', 'woocommerce' )
29             )
30         );
31         parent::__construct();
32     }
33 
34     /**
35      * widget function.
36      *
37      * @see WP_Widget
38      * @access public
39      * @param array $args
40      * @param array $instance
41      * @return void
42      */
43     function widget( $args, $instance ) {
44         extract( $args );
45 
46         $title = $instance['title'];
47         $title = apply_filters('widget_title', $title, $instance, $this->id_base);
48 
49         echo $before_widget;
50 
51         if ( $title )
52             echo $before_title . $title . $after_title;
53 
54         get_product_search_form();
55 
56         echo $after_widget;
57     }
58 }
59 
60 register_widget( 'WC_Widget_Product_Search' );
WooCommerce API documentation generated by ApiGen 2.8.0