web/wp-content/themes/twentytwelve/author.php
changeset 204 09a1c134465b
equal deleted inserted replaced
203:f507feede89a 204:09a1c134465b
       
     1 <?php
       
     2 /**
       
     3  * The template for displaying Author Archive pages.
       
     4  *
       
     5  * Used to display archive-type pages for posts by an author.
       
     6  *
       
     7  * Learn more: http://codex.wordpress.org/Template_Hierarchy
       
     8  *
       
     9  * @package WordPress
       
    10  * @subpackage Twenty_Twelve
       
    11  * @since Twenty Twelve 1.0
       
    12  */
       
    13 
       
    14 get_header(); ?>
       
    15 
       
    16 	<section id="primary" class="site-content">
       
    17 		<div id="content" role="main">
       
    18 
       
    19 		<?php if ( have_posts() ) : ?>
       
    20 
       
    21 			<?php
       
    22 				/* Queue the first post, that way we know
       
    23 				 * what author we're dealing with (if that is the case).
       
    24 				 *
       
    25 				 * We reset this later so we can run the loop
       
    26 				 * properly with a call to rewind_posts().
       
    27 				 */
       
    28 				the_post();
       
    29 			?>
       
    30 
       
    31 			<header class="archive-header">
       
    32 				<h1 class="archive-title"><?php printf( __( 'Author Archives: %s', 'twentytwelve' ), '<span class="vcard"><a class="url fn n" href="' . esc_url( get_author_posts_url( get_the_author_meta( "ID" ) ) ) . '" title="' . esc_attr( get_the_author() ) . '" rel="me">' . get_the_author() . '</a></span>' ); ?></h1>
       
    33 			</header><!-- .archive-header -->
       
    34 
       
    35 			<?php
       
    36 				/* Since we called the_post() above, we need to
       
    37 				 * rewind the loop back to the beginning that way
       
    38 				 * we can run the loop properly, in full.
       
    39 				 */
       
    40 				rewind_posts();
       
    41 			?>
       
    42 
       
    43 			<?php twentytwelve_content_nav( 'nav-above' ); ?>
       
    44 
       
    45 			<?php
       
    46 			// If a user has filled out their description, show a bio on their entries.
       
    47 			if ( get_the_author_meta( 'description' ) ) : ?>
       
    48 			<div class="author-info">
       
    49 				<div class="author-avatar">
       
    50 					<?php echo get_avatar( get_the_author_meta( 'user_email' ), apply_filters( 'twentytwelve_author_bio_avatar_size', 60 ) ); ?>
       
    51 				</div><!-- .author-avatar -->
       
    52 				<div class="author-description">
       
    53 					<h2><?php printf( __( 'About %s', 'twentytwelve' ), get_the_author() ); ?></h2>
       
    54 					<p><?php the_author_meta( 'description' ); ?></p>
       
    55 				</div><!-- .author-description	-->
       
    56 			</div><!-- .author-info -->
       
    57 			<?php endif; ?>
       
    58 
       
    59 			<?php /* Start the Loop */ ?>
       
    60 			<?php while ( have_posts() ) : the_post(); ?>
       
    61 				<?php get_template_part( 'content', get_post_format() ); ?>
       
    62 			<?php endwhile; ?>
       
    63 
       
    64 			<?php twentytwelve_content_nav( 'nav-below' ); ?>
       
    65 
       
    66 		<?php else : ?>
       
    67 			<?php get_template_part( 'content', 'none' ); ?>
       
    68 		<?php endif; ?>
       
    69 
       
    70 		</div><!-- #content -->
       
    71 	</section><!-- #primary -->
       
    72 
       
    73 <?php get_sidebar(); ?>
       
    74 <?php get_footer(); ?>