Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if ( ! function_exists( 'contributors_author_list' ) ) :
- /**
- * Prints author contributors.
- */
- function contributors_author_list() {
- $contributor_ids = get_users( array(
- 'fields' => 'ID',
- 'orderby' => 'post_count',
- 'order' => 'DESC',
- 'who' => 'authors',
- ) );
- foreach ( $contributor_ids as $contributor_id ) :
- $post_count = count_user_posts( $contributor_id );
- // Move on if user has not published a post (yet).
- if ( ! $post_count ) {
- continue;
- }
- ?>
- <div class="contributor">
- <div class="contributor-info">
- <div class="contributor-avatar"><?php echo get_avatar( $contributor_id, 230 ); ?></div>
- <h2 class="contributor-name"><?php echo get_the_author_meta( 'display_name', $contributor_id ); ?></h2>
- <a class="contributor-facebook-link" href="<?php echo esc_url( get_the_author_meta( 'facebook_link' ) ); ?>"></a>
- <a class="contributor-google-link" href="<?php echo esc_url( get_the_author_meta( 'google_link' ) ); ?>"></a>
- <a class="contributor-twitter-link" href="<?php echo esc_url( get_the_author_meta( 'twitter_link' ) ); ?>"></a>
- <a class="contributor-rss-link" href="<?php echo esc_url( get_the_author_meta( 'rss_link' ) ); ?>"></a>
- <a class="contributor-email-link" href="mailto:<?php echo esc_url( get_the_author_meta( 'user_email' ) ); ?>"></a>
- <div class="contributor-summary">
- <p class="contributor-bio">
- <?php echo get_the_author_meta( 'description', $contributor_id ); ?></p>
- <p><a class="contributor-posts-link" href="<?php echo esc_url( get_author_posts_url( $contributor_id ) ); ?>">
- <?php printf( _n( '%d Article', '%d Articles', $post_count, 'wpsites' ), $post_count ); ?>
- </a></p>
- </div><!-- .contributor-summary -->
- </div><!-- .contributor-info -->
- </div><!-- .contributor -->
- <?php
- endforeach;
- }
- endif;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement