Make WordPress Core

Changeset 13147


Ignore:
Timestamp:
02/14/2010 10:02:38 AM (14 years ago)
Author:
dd32
Message:

Replace $authordata usage with API, Restore "Also posted in.."/"Also tagged..." on taxonomy archives, Handle Excerpts for Asides correctly on Archives. See #9015

Location:
trunk/wp-content/themes/twentyten
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-content/themes/twentyten/attachment.php

    r13129 r13147  
    1313                    <div class="entry-meta">
    1414                        <span class="meta-prep meta-prep-author"><?php _e( 'By ', 'twentyten' ); ?></span>
    15                         <span class="author vcard"><a class="url fn n" href="<?php echo get_author_posts_url( $authordata->ID, $authordata->user_nicename ); ?>" title="<?php printf( esc_attr__( 'View all posts by %s', 'twentyten' ), $authordata->display_name ); ?>"><?php the_author(); ?></a></span>
     15                        <span class="author vcard"><a class="url fn n" href="<?php echo get_author_posts_url( get_the_author_meta('ID') ); ?>" title="<?php printf( esc_attr__( 'View all posts by %s', 'twentyten' ), $authordata->display_name ); ?>"><?php the_author(); ?></a></span>
    1616                        <span class="meta-sep"><?php _e( ' | ', 'twentyten' ); ?></span>
    1717                        <span class="meta-prep meta-prep-entry-date"><?php _e( 'Published ', 'twentyten' ); ?></span>
  • trunk/wp-content/themes/twentyten/author.php

    r13146 r13147  
    66<?php the_post(); ?>
    77
    8                 <h1 class="page-title author"><?php printf( __( 'Author Archives: <span class="vcard">%s</span>', 'twentyten' ), "<a class='url fn n' href='$authordata->user_url' title='" . esc_attr(get_the_author()) . "' rel='me'>" . get_the_author() . "</a>" ); ?></h1>
     8                <h1 class="page-title author"><?php printf( __( 'Author Archives: <span class="vcard">%s</span>', 'twentyten' ), "<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>" ); ?></h1>
    99
    1010<?php if ( get_the_author_meta('description') ) : // If a user has filled out their decscription show a bio on their entries  ?>
  • trunk/wp-content/themes/twentyten/functions.php

    r13144 r13147  
    119119add_filter( 'gallery_style', 'twentyten_remove_gallery_css' );
    120120
    121 
    122 // For category lists on category archives: Returns other categories except the current one (redundant)
    123 function cats_meow( $glue ) {
    124     $current_cat = single_cat_title( '', false );
    125     $separator = "\n";
    126     $cats = explode( $separator, get_the_category_list($separator) );
    127     foreach ( $cats as $i => $str ) {
    128         if ( strstr( $str, ">$current_cat<" ) ) {
    129             unset( $cats[$i] );
    130             break;
     121function twentyten_cat_list() {
     122    return twentyten_term_list('category', ', ', __('Posted in %s', 'twentyten'), __('Also posted in %s', 'twentyten') );
     123}
     124function twentyten_tag_list() {
     125    return twentyten_term_list('post_tag', ', ', __('Tagged %s', 'twentyten'), __('Also tagged %s', 'twentyten') );
     126}
     127function twentyten_term_list($taxonomy, $glue = ', ', $text = '', $also_text = '') {
     128    global $wp_query, $post;
     129    $current_term = $wp_query->queried_object;
     130    $terms = wp_get_object_terms($post->ID, $taxonomy);
     131    // If we're viewing a Taxonomy page..
     132    if ( isset($current_term->taxonomy) && $taxonomy == $current_term->taxonomy ) {
     133        // Remove the term from display.
     134        foreach ( (array)$terms as $key => $term ) {
     135            if ( $term->term_id == $current_term->term_id ) {
     136                unset($terms[$key]);
     137                break;
     138            }
    131139        }
     140        // Change to Also text as we've now removed something from the terms list.
     141        $text = $also_text;
    132142    }
    133     if ( empty($cats) )
    134         return false;
    135 
    136     return trim( join( $glue, $cats ) );
    137 } // end cats_meow
    138 
    139 
    140 // For tag lists on tag archives: Returns other tags except the current one (redundant)
    141 function tag_ur_it( $glue ) {
    142     $current_tag = single_tag_title( '', '',  false );
    143     $separator = "\n";
    144     $tags = explode( $separator, get_the_tag_list( "", "$separator", "" ) );
    145     foreach ( $tags as $i => $str ) {
    146         if ( strstr( $str, ">$current_tag<" ) ) {
    147             unset( $tags[$i] );
    148             break;
    149         }
     143    $tlist = array();
     144    $rel = 'category' == $taxonomy ? 'rel="category"' : 'rel="tag"';
     145    foreach ( (array)$terms as $term ) {
     146        $tlist[] = '<a href="' . get_term_link( $term, $taxonomy ) . '" title="' . esc_attr( sprintf( __( 'View all posts in %s', 'twentyten' ), $term->name ) ) . '" ' . $rel . '>' . $term->name . '</a>';
    150147    }
    151     if ( empty($tags) )
    152         return false;
    153 
    154     return trim( join( $glue, $tags ) );
    155 } // end tag_ur_it
     148    if ( !empty($tlist) )
     149        return sprintf($text, join($glue, $tlist));
     150    return '';
     151}
    156152
    157153// Register widgetized areas
  • trunk/wp-content/themes/twentyten/loop.php

    r13141 r13147  
    1515            <a href="<?php the_permalink(); ?>" title="<?php the_time(); ?>" rel="bookmark"><span class="entry-date"><?php echo get_the_date(); ?></span></a>
    1616            <span class="meta-sep"> <?php _e( 'by ', 'twentyten' ); ?> </span>
    17             <span class="author vcard"><a class="url fn n" href="<?php echo get_author_posts_url( $authordata->ID ); ?>" title="<?php printf( esc_attr__( 'View all posts by %s', 'twentyten' ), get_the_author() ); ?>"><?php the_author(); ?></a></span>
     17            <span class="author vcard"><a class="url fn n" href="<?php echo get_author_posts_url( get_the_author_meta('ID') ); ?>" title="<?php printf( esc_attr__( 'View all posts by %s', 'twentyten' ), get_the_author() ); ?>"><?php the_author(); ?></a></span>
    1818        </div><!-- .entry-meta -->
    1919
     
    4747<?php } elseif ( in_category( 'asides' ) ) { ?>
    4848    <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
     49<?php if ( is_archive() || is_search() ) : //Only display Excerpts for archives & search ?>
     50        <div class="entry-summary">
     51            <?php the_excerpt( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentyten' ) ); ?>
     52        </div><!-- .entry-summary -->
     53<?php else : ?>
    4954        <div class="entry-content">
    5055            <?php the_content( __( 'Continue&nbsp;reading&nbsp;<span class="meta-nav">&rarr;</span>', 'twentyten' ) ); ?>
    5156        </div><!-- .entry-content -->
     57<?php endif; ?>
    5258
    5359        <div class="entry-utility">
     
    5561            <a href="<?php the_permalink(); ?>" title="<?php the_time(); ?>" rel="bookmark"><span class="entry-date"><?php echo get_the_date(); ?></span></a>
    5662            <span class="meta-sep"> <?php _e( ' by ', 'twentyten' ); ?> </span>
    57             <span class="author vcard"><a class="url fn n" href="<?php echo get_author_posts_url( $authordata->ID ); ?>" title="<?php printf( esc_attr__( 'View all posts by %s', 'twentyten' ), get_the_author() ); ?>"><?php the_author(); ?></a></span>
    58             <span class="meta-sep"><?php __( ' | ', 'twentyten' ); ?></span>
     63            <span class="author vcard"><a class="url fn n" href="<?php echo get_author_posts_url( get_the_author_meta('ID') ); ?>" title="<?php printf( esc_attr__( 'View all posts by %s', 'twentyten' ), get_the_author() ); ?>"><?php the_author(); ?></a></span>
     64            <span class="meta-sep"><?php _e( ' | ', 'twentyten' ); ?></span>
    5965            <span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'twentyten' ), __( '1 Comment', 'twentyten' ), __( '% Comments', 'twentyten' ) ); ?></span>
    6066            <?php edit_post_link( __( 'Edit', 'twentyten' ), "<span class=\"meta-sep\">|</span>\n\t\t\t\t\t\t<span class=\"edit-link\">", "</span>\n\t\t\t\t\t\n" ); ?>
     
    7278the_permalink(); ?>" title="<?php the_time(); ?>" rel="bookmark"><span class="entry-date"><?php echo get_the_date(); ?></span></a>
    7379            <span class="meta-sep"><?php _e( ' by ', 'twentyten' ); ?></span>
    74             <span class="author vcard"><a class="url fn n" href="<?php echo get_author_posts_url( $authordata->ID ); ?>" title="<?php printf( esc_attr__( 'View all posts by %s', 'twentyten' ), get_the_author() ); ?>"><?php the_author(); ?></a></span>
     80            <span class="author vcard"><a class="url fn n" href="<?php echo get_author_posts_url( get_the_author_meta('ID') ); ?>" title="<?php printf( esc_attr__( 'View all posts by %s', 'twentyten' ), get_the_author() ); ?>"><?php the_author(); ?></a></span>
    7581        </div><!-- .entry-meta -->
    7682
     
    8793
    8894        <div class="entry-utility">
    89             <span class="cat-links"><span class="entry-utility-prep entry-utility-prep-cat-links"><?php _e( 'Posted in ', 'twentyten' ); ?></span><?php echo get_the_category_list( ', ' ); ?></span>
    90             <span class="meta-sep"><?php __( ' | ', 'twentyten' ); ?></span>
    91             <?php the_tags( '<span class="tag-links"><span class="entry-utility-prep entry-utility-prep-tag-links">' . __('Tagged ', 'twentyten' ) . '</span>', ", ", "</span>\n\t\t\t\t\t\t<span class=\"meta-sep\">|</span>\n" ); ?>
     95            <span class="cat-links"><span class="entry-utility-prep entry-utility-prep-cat-links"><?php echo twentyten_cat_list(); ?></span></span>
     96            <span class="meta-sep"><?php _e( ' | ', 'twentyten' ); ?></span>
     97            <?php $tags_text = twentyten_tag_list(); ?>
     98            <?php if ( !empty($tags_text) ) : ?>
     99            <span class="tag-links"><span class="entry-utility-prep entry-utility-prep-tag-links"><?php echo $tags_text; ?></span></span>
     100            <span class="meta-sep"><?php _e( ' | ', 'twentyten' ); ?></span>
     101            <?php endif; //$tags_text ?>
    92102            <span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'twentyten' ), __( '1 Comment', 'twentyten' ), __( '% Comments', 'twentyten' ) ); ?></span>
    93103            <?php edit_post_link( __( 'Edit', 'twentyten' ), "<span class=\"meta-sep\">|</span>\n\t\t\t\t\t\t<span class=\"edit-link\">", "</span>\n\t\t\t\t\t\n" ); ?>
  • trunk/wp-content/themes/twentyten/single.php

    r13128 r13147  
    1616                    <div class="entry-meta">
    1717                        <span class="meta-prep meta-prep-author"><?php _e( 'Posted by ', 'twentyten' ); ?></span>
    18                         <span class="author vcard"><a class="url fn n" href="<?php echo get_author_posts_url( $authordata->ID, $authordata->user_nicename ); ?>" title="<?php printf( esc_attr__( 'View all posts by %s', 'twentyten' ), get_the_author() ); ?>"><?php the_author(); ?></a></span>
     18                        <span class="author vcard"><a class="url fn n" href="<?php echo get_author_posts_url( get_the_author_meta('ID') ); ?>" title="<?php printf( esc_attr__( 'View all posts by %s', 'twentyten' ), get_the_author() ); ?>"><?php the_author(); ?></a></span>
    1919                        <span class="meta-sep"><?php _e( ' on ', 'twentyten' ); ?> </span>
    2020                        <a href="<?php the_permalink(); ?>" title="<?php the_time(); ?>" rel="bookmark"><span class="entry-date"><?php echo get_the_date(); ?></span></a>
     
    3636                            <?php the_author_meta('description'); ?>
    3737                            <div id="author-link">
    38                                 <a href="<?php echo get_author_posts_url( $authordata->ID ); ?>" title="<?php printf( esc_attr__( 'View all posts by %s', 'twentyten' ), get_the_author() ); ?>"><?php _e( 'View all posts by ', 'twentyten' ); ?><?php the_author(); ?> &rarr;</a>
     38                                <a href="<?php echo get_author_posts_url( get_the_author_meta('ID') ); ?>" title="<?php printf( esc_attr__( 'View all posts by %s', 'twentyten' ), get_the_author() ); ?>"><?php _e( 'View all posts by ', 'twentyten' ); ?><?php the_author(); ?> &rarr;</a>
    3939                            </div><!-- #author-link -->
    4040                        </div><!-- #author-description  -->
Note: See TracChangeset for help on using the changeset viewer.