Make WordPress Core

Ticket #14408: garyc40.14408.diff

File garyc40.14408.diff, 1.7 KB (added by garyc40, 13 years ago)

set $authordata when is_author = true

  • wp-content/themes/twentyten/author.php

    diff --git wp-content/themes/twentyten/author.php wp-content/themes/twentyten/author.php
    index 2bd48c8..71963b5 100644
    get_header(); ?> 
    1212                <div id="container">
    1313                        <div id="content" role="main">
    1414
    15 <?php
    16         /* Queue the first post, that way we know who
    17          * the author is when we try to get their name,
    18          * URL, description, avatar, etc.
    19          *
    20          * We reset this later so we can run the loop
    21          * properly with a call to rewind_posts().
    22          */
    23         if ( have_posts() )
    24                 the_post();
    25 ?>
    26 
    2715                                <h1 class="page-title author"><?php printf( __( 'Author Archives: %s', 'twentyten' ), "<span class='vcard'><a class='url fn n' href='" . get_author_posts_url( get_the_author_meta( 'ID' ) ) . "' title='" . esc_attr( get_the_author() ) . "' rel='me'>" . get_the_author() . "</a></span>" ); ?></h1>
    2816
    2917<?php
    if ( get_the_author_meta( 'description' ) ) : ?> 
    4129<?php endif; ?>
    4230
    4331<?php
    44         /* Since we called the_post() above, we need to
    45          * rewind the loop back to the beginning that way
    46          * we can run the loop properly, in full.
    47          */
    48         rewind_posts();
    4932
    5033        /* Run the loop for the author archive page to output the authors posts
    5134         * If you want to overload this in a child theme then include a file
  • wp-includes/query.php

    diff --git wp-includes/query.php wp-includes/query.php
    index 66867af..094b727 100644
    class WP_Query { 
    26802680                                }
    26812681                        }
    26822682                }
     2683               
     2684                if ( $this->is_author ) {
     2685                        global $authordata;
     2686                        $authordata = $this->get_queried_object();
     2687                }
    26832688
    26842689                if ( !$q['suppress_filters'] )
    26852690                        $this->posts = apply_filters_ref_array('the_posts', array( $this->posts, &$this ) );