WordPress.org

Make WordPress Core

Changeset 12915


Ignore:
Timestamp:
01/31/2010 09:32:39 PM (9 years ago)
Author:
westi
Message:

Support specific author templates by id or user_nicename. Fixes #12064 props nacin.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/theme.php

    r12890 r12915  
    711711 */
    712712function get_author_template() {
    713     return get_query_template('author');
     713    $author_id = absint( get_query_var( 'author' ) );
     714    $author = get_user_by( 'id', $author_id )->user_nicename;
     715
     716    $templates = array();
     717
     718    if ( $author )
     719        $templates[] = "author-{$author}.php";
     720    if ( $author_id )
     721        $templates[] = "author-{$author_id}.php";
     722    $templates[] = 'author.php';
     723
     724    $template = locate_template( $templates );
     725    return apply_filters( 'author_template', $template );
    714726}
    715727
Note: See TracChangeset for help on using the changeset viewer.