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 '

'.$obj_author->description.'

'; // Show contact links $contact_p = ''; If (IsSet($settings['show_website']) && $settings['show_website'] == 'yes' && $obj_author->user_url != '') $contact_p .= 'Website'; If (IsSet($settings['show_jabber']) && $settings['show_jabber'] == 'yes' && IsSet ($obj_author->jabber)) $contact_p .= 'Jabber'; If (IsSet($settings['show_aim']) && $settings['show_aim'] == 'yes' && IsSet ($obj_author->aim)) $contact_p .= 'AIM'; If (IsSet($settings['show_yim']) && $settings['show_yim'] == 'yes' && IsSet ($obj_author->yim)) $contact_p .= 'Yahoo!'; If ($contact_p != '') Echo '

'.$contact_p.'

'; // 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').':
'; Echo ' '.__('Show the authors avatar' , 'theme').'
'; Echo ' '.__('Show the authors url link' , 'theme').'
'; Echo ' '.__('Show the authors jabber name' , 'theme').'
'; Echo ' '.__('Show the authors AIM name' , 'theme').'
'; Echo ' '.__('Show the authors YIM name' , 'theme').'
'; } Function update ($new_settings, $old_settings){ return $new_settings; } } /* End of File */