Advertisement
iamkingsleyf

userprofile

Apr 27th, 2014
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.77 KB | None | 0 0
  1. if ( ! function_exists( 'contributors_author_list' ) ) :
  2. /**
  3.  * Prints author contributors.
  4.  */
  5. function contributors_author_list() {
  6.     $contributor_ids = get_users( array(
  7.         'fields'  => 'ID',
  8.         'orderby' => 'post_count',
  9.         'order'   => 'DESC',
  10.         'who'     => 'authors',
  11.     ) );
  12.  
  13.     foreach ( $contributor_ids as $contributor_id ) :
  14.         $post_count = count_user_posts( $contributor_id );
  15.  
  16.         // Move on if user has not published a post (yet).
  17.         if ( ! $post_count ) {
  18.             continue;
  19.         }
  20.  
  21. ?>
  22. <div class="contributor">
  23. <div class="contributor-info">
  24. <div class="contributor-avatar"><?php echo get_avatar( $contributor_id, 230 ); ?></div>
  25. <h2 class="contributor-name"><?php echo get_the_author_meta( 'display_name', $contributor_id ); ?></h2>
  26. <a class="contributor-facebook-link" href="<?php echo esc_url( get_the_author_meta( 'facebook_link' ) ); ?>"></a>
  27. <a class="contributor-google-link" href="<?php echo esc_url( get_the_author_meta( 'google_link' ) ); ?>"></a>
  28. <a class="contributor-twitter-link" href="<?php echo esc_url( get_the_author_meta( 'twitter_link' ) ); ?>"></a>
  29. <a class="contributor-rss-link" href="<?php echo esc_url( get_the_author_meta( 'rss_link' ) ); ?>"></a>
  30. <a class="contributor-email-link" href="mailto:<?php echo esc_url( get_the_author_meta( 'user_email' ) ); ?>"></a>
  31. <div class="contributor-summary">
  32. <p class="contributor-bio">
  33. <?php echo get_the_author_meta( 'description', $contributor_id ); ?></p>
  34. <p><a class="contributor-posts-link" href="<?php echo esc_url( get_author_posts_url( $contributor_id ) ); ?>">
  35. <?php printf( _n( '%d Article', '%d Articles', $post_count, 'wpsites' ), $post_count ); ?>
  36.                 </a></p>
  37.             </div><!-- .contributor-summary -->
  38.         </div><!-- .contributor-info -->
  39.     </div><!-- .contributor -->
  40.  
  41.     <?php
  42.     endforeach;
  43. }
  44. endif;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement