Advertisement
joelgoodman

Untitled

May 3rd, 2011
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.73 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. }
  50.  
  51. Markup:
  52.  
  53.         <div class="blogger sidepost">
  54.                 <a href="<?php echo $user_link; ?>"><?php echo get_avatar($curauth->user_email, '80'); ?></a>
  55.                 <div class="author_text  clearfix">
  56.                 <h4><a href="<?php echo $user_link; ?>" title="<?php echo $curauth->display_name; ?>"><span>About</span> <?php echo $curauth->display_name; ?></a></h4>
  57.                 <p><?php echo $curauth->description; ?></p>
  58.                 </div>
  59.         </div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement