WP_Widget ( False, __('Author Info', 'theme'), Array('description' => __('You can add this widget to sidebars on author relevant sections, i.e. pages, posts or author archives.', 'theme'))); $this->base_url = get_option('home').'/'.Str_Replace("\\", '/', SubStr( RealPath(DirName(__FILE__)), Strlen(ABSPATH) )); // Register as Widget Add_Action ('widgets_init', Array($this, 'Register')); } Function Register(){ Register_Widget('widget_theme_author_info'); Add_Action('wp_head', Array($this, 'Include_CSS')); } Function Include_CSS(){ Echo ''; } Function widget ($args, $settings){ If ($settings['title'] == '') $settings['title'] = __('About the author', 'theme'); If ( is_author() ){ Global $wp_query; $obj_author = $wp_query->get_queried_object(); } ElseIf ( is_singular() ) { Global $post; $obj_author = get_userdata( $post->post_author ); } Else { return False; } Echo $args['before_widget']; Echo $args['before_title'] . $settings['title'] . $args['after_title']; Echo '
'.sprintf(_c('Author: %s', 'theme'), $obj_author->display_name).'
'; // Show gravatar If ($settings['show_avatar'] && IsSet ($obj_author->user_email)) Echo get_avatar($obj_author->user_email, 70); // Show the profile text If (IsSet ($obj_author->description)) Echo ''; // Show contact links $contact_p = ''; If (IsSet($settings['show_website']) && $settings['show_website'] == 'yes' && $obj_author->user_url != '') $contact_p .= ''; If (IsSet($settings['show_jabber']) && $settings['show_jabber'] == 'yes' && IsSet ($obj_author->jabber)) $contact_p .= ''; If (IsSet($settings['show_aim']) && $settings['show_aim'] == 'yes' && IsSet ($obj_author->aim)) $contact_p .= ''; If (IsSet($settings['show_yim']) && $settings['show_yim'] == 'yes' && IsSet ($obj_author->yim)) $contact_p .= ''; If ($contact_p != '') Echo ''; // Show link to the authors posts $posts_link_caption = SPrintF(__('All posts by %s', 'theme'), $obj_author->display_name); Echo ''; Echo $args['after_widget']; } Function form ($settings){ // Show Form: Echo __('Title', 'theme').':