User photo plugin (optional). If your blogs are co-authored by multiple people then you can use Co-Authors Plus plugin (optional) to display all author profiles on the post page. Author: Debashish Chakrabarty Author URI: http://www.debashish.com Min WP Version: 3.0 */ //----------------------------------------------------------------------------- ?> 'AuthorSpotlight_Widget', 'description' => "Sidebar widget to display Author(s)' profile on a post page." ); /* Widget control settings. */ $control_ops = array('width' => 200, 'height' => 300); parent::__construct('authorspotlight', __('AuthorSpotlight'), $widget_ops, $control_ops); $this->icon_image_url = plugin_dir_url(__FILE__) . 'images/'; } function widget( $args, $instance ) { // If Co-Authors plus plugin exists display all co-aothor profiles one after another if(function_exists('coauthors_posts_links')) { $i = new CoAuthorsIterator(); $cnt = 1; while($i->iterate()){ // the iterator overwrites the global authordata variable on each iteration $instance['seq'] = $cnt++; $instance['isLast'] = $i->is_last(); $this->_displayAuthor($args, $instance); } } else { // Normal behavior, one author per blog post $instance['seq'] = 1; $instance['isLast'] = true; $this->_displayAuthor( $args, $instance); } } function form($instance) { $instance = wp_parse_args( (array) $instance, array( 'title' => 'Author Spotlight', 'readfulltext' => 'Read Full', 'moretext' => 'More posts by the Author »', 'websitetext' => 'Website: ', 'charlimit' => '1000') ); $title = strip_tags($instance['title']); $readfulltext = strip_tags($instance['readfulltext']); $moretext = strip_tags($instance['moretext']); $websitetext = strip_tags($instance['websitetext']); $charlimit = strip_tags($instance['charlimit']); ?>

Which social icons should be displayed for the author?
_getIconsAsArray() as $key => $data ) { printf('get_field_id($key), $this->get_field_name($key)); printf("%s", checked( 1, $instance[$key] )); echo(' /> '); printf('', $data['img_src'], $data['img_title'] ); printf('%s', $data['img_seperator']); } ?>

Note: To display custom photos with User Profiles, please use the User photo plugin. The CoAuthors Plus plugin will help you add multiple authors and display their profiles.

_getIconsAsArray() as $key => $data ) { $instance[$key] = strip_tags($new_instance[$key]); } return $instance; } // Does the actual work of preparing the profile markup private function _displayAuthor($args, $instance){ global $authordata; extract( $args ); // extract arguments if((is_single() || is_page()) && $authordata->ID){ if($instance['seq'] == 1){ echo $before_widget; echo $before_title . $instance['title'] . $after_title; } echo '
'; echo '
'; //Display author name echo '

'.get_the_author_firstname().' '.get_the_author_lastname().'

'; //Display the social icons $socialDiv = ""; $iconCount = 0; $style = "height:12px"; foreach ( $this->_getIconsAsArray() as $key => $data ) { $print_img = false; $social_url = get_the_author_meta( $key, $authordata->ID ); //The Website or Homepahge URL should be read from Author-Data if($data['img_title'] == 'Homepage' && $authordata->user_url){ $socialDiv .= ''; $print_img = true; } //while the other Social URLs come from Author meta, we added else if($social_url != "") { $socialDiv .= ''; $print_img = true; } //If the URL is available & the Icon is enabled from Widget Admin, display it if($print_img && $instance[$key]){ $socialDiv .= ''; ++$iconCount; } } if($iconCount <= 0){ $style = "display:none;"; } else if(($iconCount/2) >= 6){ $style = "height: 36px"; } printf('
', $style); echo $socialDiv; echo "
"; //Display User photo OR the Gravatar if(function_exists('userphoto_exists') && userphoto_exists($authordata)){ userphoto_thumbnail($authordata); } else { echo get_avatar($authordata->ID, 96); } //Display author profile, with link to full profile $author_posts_link = get_author_posts_url($authordata->ID, $authordata->user_nicename ); echo '
'; echo $this->_getSnippet(get_the_author_description(),$instance['charlimit'],'...').' '.$instance['readfulltext'].''; echo "
"; echo ''; echo "
"; echo "
"; if($instance['isLast']){ echo $after_widget; } } } // Returns a trimmed String of specified length function _getSnippet($text, $length=1000, $tail="...") { $text = trim($text); $txtl = strlen($text); if($txtl > $length) { for($i=1;$text[$length-$i]!=" ";$i++) { if($i == $length) { return substr($text,0,$length) . $tail; } } $text = substr($text,0,$length-$i+1) . $tail; } return $text; } function _getIconsAsArray() { return array( 'home' => array( 'img_src' => $this->icon_image_url . 'home.png', 'img_title' => 'Homepage', 'img_seperator' => ' ' ), 'facebook' => array( 'img_src' => $this->icon_image_url . 'facebook.png', 'img_title' => 'Facebook', 'img_seperator' => ' ' ), 'twitter' => array( 'img_src' => $this->icon_image_url . 'twitter.png', 'img_title' => 'Twitter', 'img_seperator' => ' ' ), 'linkedin' => array( 'img_src' => $this->icon_image_url . 'linkedin.png', 'img_title' => 'LinkedIn', 'img_seperator' => ' ' ), 'flickr' => array( 'img_src' => $this->icon_image_url . 'flickr.png', 'img_title' => 'Flickr', 'img_seperator' => ' ' ), 'myspace' => array( 'img_src' => $this->icon_image_url . 'myspace.png', 'img_title' => 'MySpace', 'img_seperator' => '
' ), 'friendfeed' => array( 'img_src' => $this->icon_image_url . 'friendfeed.png', 'img_title' => 'Friend Feed', 'img_seperator' => ' ' ), 'delicious' => array( 'img_src' => $this->icon_image_url . 'delicious.png', 'img_title' => 'Delicious', 'img_seperator' => ' ' ), 'digg' => array( 'img_src' => $this->icon_image_url . 'digg.png', 'img_title' => 'Digg', 'img_seperator' => ' ' ), 'feed' => array( 'img_src' => $this->icon_image_url . 'feed.png', 'img_title' => 'Feed', 'img_seperator' => ' ' ), 'tumblr' => array( 'img_src' => $this->icon_image_url . 'tumblr.png', 'img_title' => 'Tumblr', 'img_seperator' => ' ' ), 'youtube' => array( 'img_src' => $this->icon_image_url . 'youtube.png', 'img_title' => 'YouTube', 'img_seperator' => '' ), ); } } ?>