'Display Products List Widget', 'classname' => 'articles-products-list-widget' ) ); wp_enqueue_script('countdown_js', PBR_THEME_URI.'/js/countdown.js', array(), false, true); } // print to frontend function widget( $args, $instance ) { // Widget output extract($args); echo $before_widget; echo $before_title . $instance['title'] . $after_title; $tpl = PBR_THEME_DIR .'/templates/widgets/products_list.php'; require( $tpl ); echo $after_widget; } function update( $new_instance, $old_instance ) { // Save widget options $instance['title'] = $new_instance['title']; $instance['type'] = $new_instance['type']; $instance['number'] = $new_instance['number']; $instance['columns'] = $new_instance['columns']; $instance['addition_class'] = $new_instance['addition_class']; $instance['layout_type'] = $new_instance['layout_type']; return $instance; } function form( $instance ) { //default $instance = wp_parse_args( $instance, array( 'title' => 'Products List', 'type' => 'best_selling', 'number' => '4', 'columns' => '4', 'addition_class' => '', 'layout_type' => 'type1' ) ); // Output admin widget options form $columns = [ '1' => __('1', 'basee'), '2' => __('2', 'basee'), '3' => __('3', 'basee'), '4' => __('4', 'basee'), '6' => __('6', 'basee'), ]; $types = [ 'best_selling' => __('Best Selling', 'basee'), 'featured_product' => __('Featured', 'basee'), 'top_rate' => __('Top Rate', 'basee'), 'recent_product' => __('Recent Product', 'basee'), 'on_sale' => __('On Sale', 'basee'), 'recent_review' => __('Recent Review', 'basee'), 'deals' => __('Deals', 'basee') ]; $layout_types = [ 'type1' => __('Type 1', 'basee'), 'type2' => __('Type 2', 'basee'), ]; $title = esc_attr($instance['title']); $type = esc_attr($instance['type']); $number = esc_attr($instance['number']); $column = esc_attr($instance['columns']); $addition_class = esc_attr($instance['addition_class']); ?>