Advertisement
joelgoodman

WP Author/Bio

May 3rd, 2011
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.32 KB | None | 0 0
  1. // Register Custom Template Widgets
  2. class Post_Author_Widget extends WP_Widget {
  3.     function Post_Author_Widget() {
  4.         $widget_ops = array('classname' => 'postAuthor', 'description' => 'Displays the post author bio and gravatar.' );
  5.         $this->WP_Widget('post_author', 'Post Author', $widget_ops);
  6.     }
  7.  
  8.     function widget($args, $instance) {
  9.         extract($args, EXTR_SKIP);
  10.  
  11.         echo $before_widget;
  12.         echo get_author_bio();
  13.         echo $after_widget;
  14.     }
  15.  
  16.     function update($new_instance, $old_instance) {
  17.         function update($new_instance, $old_instance) {
  18.             $instance = $old_instance;
  19.  
  20.             return $instance;
  21.         }
  22.     }
  23. }
  24. register_widget('Post_Author_Widget');
  25.  
  26. class Blog_Author_List_Widget extends WP_Widget {
  27.     function Blog_Author_List_Widget() {
  28.         $widget_ops = array('classname' => 'authorList', 'description' => 'Lists blog contributors with gravatars and bio.' );
  29.         $this->WP_Widget('author_list', 'The Bloggers', $widget_ops);
  30.     }
  31.  
  32.     function widget($args, $instance) {
  33.         extract($args, EXTR_SKIP);
  34.  
  35.         echo $before_widget;
  36.         $title = '<span>The</span> Bloggers';
  37.         echo $before_title . $title . $after_title;
  38.         echo get_author_list();
  39.         echo $after_widget;
  40.     }
  41.  
  42.     function update($new_instance, $old_instance) {
  43.         function update($new_instance, $old_instance) {
  44.             $instance = $old_instance;
  45.  
  46.             return $instance;
  47.         }
  48.     }
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement