__( 'A widget To Display Author Profile', 'bloger' ) ) ); } /** * Helper function that holds widget fields * Array is used in update and form functions */ private function widget_fields() { $fields = array( 'feat_page_title' => array( 'bloger_widgets_name' => 'feat_page_title', 'bloger_widgets_title' => __('Page Title','bloger'), 'bloger_widgets_field_type' => 'text', 'bloger_widgets_description' => __('Displays the Page Title if left empty','bloger'), ), 'feat_page_id' => array( 'bloger_widgets_name' => 'feat_page_id', 'bloger_widgets_title' => __('Author Page','bloger'), 'bloger_widgets_field_type' => 'selectpage' ), 'feat_page_autograph' => array( 'bloger_widgets_name' => 'feat_page_autograph', 'bloger_widgets_title' => __('Signature Image','bloger'), 'bloger_widgets_field_type' => 'upload' ), 'facebook_link' => array( 'bloger_widgets_name' => 'facebook_link', 'bloger_widgets_title' => __('Facebook Link','bloger'), 'bloger_widgets_field_type' => 'text', ), 'twitter_link' => array( 'bloger_widgets_name' => 'twitter_link', 'bloger_widgets_title' => __('Twitter Link','bloger'), 'bloger_widgets_field_type' => 'text', ), 'youtube_link' => array( 'bloger_widgets_name' => 'youtube_link', 'bloger_widgets_title' => __('Youtube Link','bloger'), 'bloger_widgets_field_type' => 'text', ), 'pinterest_link' => array( 'bloger_widgets_name' => 'pinterest_link', 'bloger_widgets_title' => __('Pinterest Link','bloger'), 'bloger_widgets_field_type' => 'text', ), 'instagram_link' => array( 'bloger_widgets_name' => 'instagram_link', 'bloger_widgets_title' => __('Instagram Link','bloger'), 'bloger_widgets_field_type' => 'text', ), 'linkedin_link' => array( 'bloger_widgets_name' => 'linkedin_link', 'bloger_widgets_title' => __('linkedin Link','bloger'), 'bloger_widgets_field_type' => 'text', ), 'googleplus_link' => array( 'bloger_widgets_name' => 'googleplus_link', 'bloger_widgets_title' => __('GooglePlus Link','bloger'), 'bloger_widgets_field_type' => 'text', ), 'flickr_link' => array( 'bloger_widgets_name' => 'flickr_link', 'bloger_widgets_title' => __('Flickr Link','bloger'), 'bloger_widgets_field_type' => 'text', ), ); return $fields; } /** * Front-end display of widget. * * @see WP_Widget::widget() * * @param array $args Widget arguments. * @param array $instance Saved values from database. */ public function widget( $args, $instance ) { extract($args); if($instance!=null){ $feat_page_id = $instance['feat_page_id']; $autograph = $instance['feat_page_autograph']; if($feat_page_id){ $feat_page_query = new WP_Query('page_id='.$feat_page_id); $feat_page_title = empty($instance['feat_page_title']) ? false : $instance['feat_page_title']; $facebook = $instance['facebook_link']; $twitter = $instance['twitter_link']; $youtube = $instance['youtube_link']; $pinterest = $instance['pinterest_link']; $instagram = $instance['instagram_link']; $linkedin = $instance['linkedin_link']; $googleplus = $instance['googleplus_link']; $flickr = $instance['flickr_link']; echo wp_kses_post($before_widget); ?> have_posts()) : ?> have_posts()) : $feat_page_query->the_post(); ?>

widget_fields(); // Loop through fields foreach( $widget_fields as $widget_field ) { extract( $widget_field ); // Use helper function to get updated field values $instance[$bloger_widgets_name] = bloger_widgets_updated_field_value( $widget_field, $new_instance[$bloger_widgets_name] ); echo esc_html($instance[$bloger_widgets_name]); } return $instance; } /** * Back-end widget form. * * @see WP_Widget::form() * * @param array $instance Previously saved values from database. * * @uses accesspress_pro_widgets_show_widget_field() defined in widget-fields.php */ public function form( $instance ) { $widget_fields = $this->widget_fields(); // Loop through fields foreach( $widget_fields as $widget_field ) { // Make array elements available as variables extract( $widget_field ); $bloger_widgets_field_value = isset( $instance[$bloger_widgets_name] ) ? esc_attr( $instance[$bloger_widgets_name] ) : ''; bloger_widgets_show_widget_field( $this, $widget_field, $bloger_widgets_field_value ); } } }