esc_html__('A widget that shows quick contact information', 'buzzstore') )); } private function widget_fields() { $fields = array( 'buzzstore_quick_contact_title' => array( 'buzzstore_widgets_name' => 'buzzstore_quick_contact_title', 'buzzstore_widgets_title' => esc_html__('Title', 'buzzstore'), 'buzzstore_widgets_field_type' => 'title', ), 'buzzstore_quick_address' => array( 'buzzstore_widgets_name' => 'buzzstore_quick_address', 'buzzstore_widgets_title' => esc_html__('Contact Address', 'buzzstore'), 'buzzstore_widgets_field_type' => 'textarea', 'buzzstore_widgets_row' => 2, ), 'buzzstore_quick_phone' => array( 'buzzstore_widgets_name' => 'buzzstore_quick_phone', 'buzzstore_widgets_title' => esc_html__('Contact Number', 'buzzstore'), 'buzzstore_widgets_field_type' => 'text', ), 'buzzstore_quick_email' => array( 'buzzstore_widgets_name' => 'buzzstore_quick_email', 'buzzstore_widgets_title' => esc_html__('Contact Email Address', 'buzzstore'), 'buzzstore_widgets_field_type' => 'text', ), 'buzzstore_opening_time' => array( 'buzzstore_widgets_name' => 'buzzstore_opening_time', 'buzzstore_widgets_title' => esc_html__('Store Opening Time', 'buzzstore'), 'buzzstore_widgets_field_type' => 'textarea', 'buzzstore_widgets_row' => 2, ), ); return $fields; } public function widget($args, $instance) { extract($args); extract($instance); $title = empty( $instance['buzzstore_quick_contact_title'] ) ? '' : $instance['buzzstore_quick_contact_title']; $contact_address = empty( $instance['buzzstore_quick_address'] ) ? '' : $instance['buzzstore_quick_address']; $contact_number = empty( $instance['buzzstore_quick_phone'] ) ? '' : $instance['buzzstore_quick_phone']; $contact_email = empty( $instance['buzzstore_quick_email'] ) ? '' : $instance['buzzstore_quick_email']; $opening_time = empty( $instance['buzzstore_opening_time'] ) ? '' : $instance['buzzstore_opening_time']; echo $before_widget; if(!empty($title)) { echo '

'.esc_html( $title ).'

'; } ?>
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]) ? esc_attr($instance[$buzzstore_widgets_name]) : ''; buzzstore_widgets_show_widget_field($this, $widget_field, $buzzstore_widgets_field_value); } } }