| 1 | <?php
|
|---|
| 2 | /**
|
|---|
| 3 | * Template Name: Author Page
|
|---|
| 4 | *
|
|---|
| 5 | * @package WordPress
|
|---|
| 6 | * @subpackage Twenty_Fourteen
|
|---|
| 7 | */
|
|---|
| 8 |
|
|---|
| 9 | get_header(); ?>
|
|---|
| 10 |
|
|---|
| 11 | <div id="primary" class="content-area">
|
|---|
| 12 | <div id="content" class="site-content full-width" role="main">
|
|---|
| 13 | <?php
|
|---|
| 14 | while ( have_posts() ) : the_post(); ?>
|
|---|
| 15 |
|
|---|
| 16 | <?php get_template_part( 'content', 'page' ); ?>
|
|---|
| 17 |
|
|---|
| 18 | <?php
|
|---|
| 19 | $author_args = array(
|
|---|
| 20 | 'orderby' => 'post_count',
|
|---|
| 21 | 'who' => 'author'
|
|---|
| 22 | );
|
|---|
| 23 | $authors = get_users( $author_args );
|
|---|
| 24 |
|
|---|
| 25 | foreach ( $authors as $author ) {
|
|---|
| 26 | $post_count = count_user_posts( $author->data->ID );
|
|---|
| 27 |
|
|---|
| 28 | if( $post_count == 0 ) {
|
|---|
| 29 | continue;
|
|---|
| 30 | }
|
|---|
| 31 |
|
|---|
| 32 | $name = $author->data->display_name;
|
|---|
| 33 | $author_avatar = get_avatar( $author->data->ID, $size = '128' );
|
|---|
| 34 | $bio = get_the_author_meta( 'description', $author->data->ID );
|
|---|
| 35 | $author_url = home_url( '/author/' ) . get_the_author_meta( 'nicename', $author->data->ID );
|
|---|
| 36 | ?>
|
|---|
| 37 | <div class="contributors-box">
|
|---|
| 38 | <?php echo $author_avatar; ?>
|
|---|
| 39 |
|
|---|
| 40 | <strong class="contributor-name">
|
|---|
| 41 | <?php echo $name; ?>
|
|---|
| 42 | </strong>
|
|---|
| 43 | <p class="contributor-bio">
|
|---|
| 44 | <?php echo $bio; ?>
|
|---|
| 45 | </p>
|
|---|
| 46 | <a class="contributor-button" href="<?php echo $author_url; ?>" title="<?php echo $name; ?>">
|
|---|
| 47 | <?php echo $post_count; ?> Articles
|
|---|
| 48 | </a>
|
|---|
| 49 |
|
|---|
| 50 | </div>
|
|---|
| 51 | <?php
|
|---|
| 52 | }
|
|---|
| 53 |
|
|---|
| 54 | ?>
|
|---|
| 55 |
|
|---|
| 56 | <?php comments_template( '', true ); ?>
|
|---|
| 57 |
|
|---|
| 58 | <?php endwhile; ?>
|
|---|
| 59 |
|
|---|
| 60 | </div><!-- #content .site-content -->
|
|---|
| 61 | </div><!-- #primary .content-area -->
|
|---|
| 62 |
|
|---|
| 63 | <?php //get_sidebar( 'content' ); ?>
|
|---|
| 64 |
|
|---|
| 65 | <?php get_sidebar(); ?>
|
|---|
| 66 |
|
|---|
| 67 | <?php get_footer(); ?>
|
|---|