[ Index ]

PHP Cross Reference of WordPress Trunk (Updated Daily)

Search

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


Generated : Sun Dec 22 08:20:01 2024 Cross-referenced by PHPXref