[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

/wp-content/themes/twentytwelve/ -> author.php (source)

   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   * @link https://developer.wordpress.org/themes/basics/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">
  33                  <?php
  34                  /* translators: author display name */
  35                  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>' );
  36                  ?>
  37                  </h1>
  38              </header><!-- .archive-header -->
  39  
  40              <?php
  41                  /* Since we called the_post() above, we need to
  42                   * rewind the loop back to the beginning that way
  43                   * we can run the loop properly, in full.
  44                   */
  45                  rewind_posts();
  46              ?>
  47  
  48              <?php twentytwelve_content_nav( 'nav-above' ); ?>
  49  
  50              <?php
  51              // If a user has filled out their description, show a bio on their entries.
  52              if ( get_the_author_meta( 'description' ) ) :
  53                  ?>
  54              <div class="author-info">
  55                  <div class="author-avatar">
  56                      <?php
  57                      /**
  58                       * Filter the author bio avatar size.
  59                       *
  60                       * @since Twenty Twelve 1.0
  61                       *
  62                       * @param int $size The height and width of the avatar in pixels.
  63                       */
  64                      $author_bio_avatar_size = apply_filters( 'twentytwelve_author_bio_avatar_size', 68 );
  65                      echo get_avatar( get_the_author_meta( 'user_email' ), $author_bio_avatar_size );
  66                      ?>
  67                  </div><!-- .author-avatar -->
  68                  <div class="author-description">
  69                      <h2>
  70                      <?php
  71                      /* translators: author display name */
  72                      printf( __( 'About %s', 'twentytwelve' ), get_the_author() );
  73                      ?>
  74                      </h2>
  75                      <p><?php the_author_meta( 'description' ); ?></p>
  76                  </div><!-- .author-description    -->
  77              </div><!-- .author-info -->
  78              <?php endif; ?>
  79  
  80              <?php /* Start the Loop */ ?>
  81              <?php
  82              while ( have_posts() ) :
  83                  the_post();
  84                  ?>
  85                  <?php get_template_part( 'content', get_post_format() ); ?>
  86              <?php endwhile; ?>
  87  
  88              <?php twentytwelve_content_nav( 'nav-below' ); ?>
  89  
  90          <?php else : ?>
  91              <?php get_template_part( 'content', 'none' ); ?>
  92          <?php endif; ?>
  93  
  94          </div><!-- #content -->
  95      </section><!-- #primary -->
  96  
  97  <?php get_sidebar(); ?>
  98  <?php get_footer(); ?>


Generated: Wed Jul 17 01:00:03 2019 Cross-referenced by PHPXref 0.7.1