__('A widget that promote you busincess', 'buzzstore') )); } private function widget_fields() { $promo_type = array( 'styleone' => __('Style One', 'buzzstore'), 'styletwo' => __('Style Two', 'buzzstore') ); $fields = array( 'buzzstore_full_promo_image' => array( 'buzzstore_widgets_name' => 'buzzstore_full_promo_image', 'buzzstore_widgets_title' => __('Uplaod Promo Image', 'buzzstore'), 'buzzstore_widgets_field_type' => 'upload', ), 'buzzstore_full_promo_title' => array( 'buzzstore_widgets_name' => 'buzzstore_full_promo_title', 'buzzstore_widgets_title' => __('Title', 'buzzstore'), 'buzzstore_widgets_field_type' => 'title', ), 'buzzstore_full_promo_desc' => array( 'buzzstore_widgets_name' => 'buzzstore_full_promo_desc', 'buzzstore_widgets_title' => __('Short Description', 'buzzstore'), 'buzzstore_widgets_field_type' => 'textarea', 'buzzstore_widgets_row' => 4, ), 'buzzstore_full_promo_button_link' => array( 'buzzstore_widgets_name' => 'buzzstore_full_promo_button_link', 'buzzstore_widgets_title' => __('Promo Button Link', 'buzzstore'), 'buzzstore_widgets_field_type' => 'url', ), 'buzzstore_full_promo_button_text' => array( 'buzzstore_widgets_name' => 'buzzstore_full_promo_button_text', 'buzzstore_widgets_title' => __('Promo Button Text', 'buzzstore'), 'buzzstore_widgets_field_type' => 'text', ), 'buzzstore_full_promo_type' => array( 'buzzstore_widgets_name' => 'buzzstore_full_promo_type', 'buzzstore_widgets_title' => __('Select Full Promo Type', 'buzzstore'), 'buzzstore_widgets_field_type' => 'select', 'buzzstore_widgets_field_options' => $promo_type ), ); return $fields; } public function widget($args, $instance) { extract($args); extract($instance); $promo_image = esc_url( $instance['buzzstore_full_promo_image'] ); $title = esc_attr( $instance['buzzstore_full_promo_title'] ); $short_desc = wp_filter_nohtml_kses( $instance['buzzstore_full_promo_desc'] ); $button_link = esc_url( $instance['buzzstore_full_promo_button_link'] ); $button_text = esc_attr( $instance['buzzstore_full_promo_button_text'] ); $promo_type = esc_attr( $instance['buzzstore_full_promo_type'] ); echo $before_widget; ?>
widget_fields(); foreach ($widget_fields as $widget_field) { extract($widget_field); $instance[$buzzstore_widgets_name] = buzzstore_widgets_updated_field_value($widget_field, $new_instance[$buzzstore_widgets_name]); } return $instance; } public function form($instance) { $widget_fields = $this->widget_fields(); foreach ($widget_fields as $widget_field) { extract($widget_field); $buzzstore_widgets_field_value = !empty($instance[$buzzstore_widgets_name]) ? $instance[$buzzstore_widgets_name] : ''; buzzstore_widgets_show_widget_field($this, $widget_field, $buzzstore_widgets_field_value); } } }