Replace $authordata usage with API, Restore "Also posted in.."/"Also tagged..." on taxonomy archives, Handle Excerpts for Asides correctly on Archives. See #9015
git-svn-id: https://develop.svn.wordpress.org/trunk@13147 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
e7d1e80302
commit
2bfeae67c6
|
@ -12,7 +12,7 @@
|
|||
|
||||
<div class="entry-meta">
|
||||
<span class="meta-prep meta-prep-author"><?php _e( 'By ', 'twentyten' ); ?></span>
|
||||
<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>
|
||||
<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>
|
||||
<span class="meta-sep"><?php _e( ' | ', 'twentyten' ); ?></span>
|
||||
<span class="meta-prep meta-prep-entry-date"><?php _e( 'Published ', 'twentyten' ); ?></span>
|
||||
<span class="entry-date"><abbr class="published" title="<?php the_time() ?>"><?php echo get_the_date(); ?></abbr></span>
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
<?php the_post(); ?>
|
||||
|
||||
<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>
|
||||
<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>
|
||||
|
||||
<?php if ( get_the_author_meta('description') ) : // If a user has filled out their decscription show a bio on their entries ?>
|
||||
<div id="entry-author-info">
|
||||
|
|
|
@ -118,41 +118,37 @@ function twentyten_remove_gallery_css() {
|
|||
}
|
||||
add_filter( 'gallery_style', 'twentyten_remove_gallery_css' );
|
||||
|
||||
|
||||
// For category lists on category archives: Returns other categories except the current one (redundant)
|
||||
function cats_meow( $glue ) {
|
||||
$current_cat = single_cat_title( '', false );
|
||||
$separator = "\n";
|
||||
$cats = explode( $separator, get_the_category_list($separator) );
|
||||
foreach ( $cats as $i => $str ) {
|
||||
if ( strstr( $str, ">$current_cat<" ) ) {
|
||||
unset( $cats[$i] );
|
||||
break;
|
||||
function twentyten_cat_list() {
|
||||
return twentyten_term_list('category', ', ', __('Posted in %s', 'twentyten'), __('Also posted in %s', 'twentyten') );
|
||||
}
|
||||
function twentyten_tag_list() {
|
||||
return twentyten_term_list('post_tag', ', ', __('Tagged %s', 'twentyten'), __('Also tagged %s', 'twentyten') );
|
||||
}
|
||||
function twentyten_term_list($taxonomy, $glue = ', ', $text = '', $also_text = '') {
|
||||
global $wp_query, $post;
|
||||
$current_term = $wp_query->queried_object;
|
||||
$terms = wp_get_object_terms($post->ID, $taxonomy);
|
||||
// If we're viewing a Taxonomy page..
|
||||
if ( isset($current_term->taxonomy) && $taxonomy == $current_term->taxonomy ) {
|
||||
// Remove the term from display.
|
||||
foreach ( (array)$terms as $key => $term ) {
|
||||
if ( $term->term_id == $current_term->term_id ) {
|
||||
unset($terms[$key]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
// Change to Also text as we've now removed something from the terms list.
|
||||
$text = $also_text;
|
||||
}
|
||||
if ( empty($cats) )
|
||||
return false;
|
||||
|
||||
return trim( join( $glue, $cats ) );
|
||||
} // end cats_meow
|
||||
|
||||
|
||||
// For tag lists on tag archives: Returns other tags except the current one (redundant)
|
||||
function tag_ur_it( $glue ) {
|
||||
$current_tag = single_tag_title( '', '', false );
|
||||
$separator = "\n";
|
||||
$tags = explode( $separator, get_the_tag_list( "", "$separator", "" ) );
|
||||
foreach ( $tags as $i => $str ) {
|
||||
if ( strstr( $str, ">$current_tag<" ) ) {
|
||||
unset( $tags[$i] );
|
||||
break;
|
||||
}
|
||||
$tlist = array();
|
||||
$rel = 'category' == $taxonomy ? 'rel="category"' : 'rel="tag"';
|
||||
foreach ( (array)$terms as $term ) {
|
||||
$tlist[] = '<a href="' . get_term_link( $term, $taxonomy ) . '" title="' . esc_attr( sprintf( __( 'View all posts in %s', 'twentyten' ), $term->name ) ) . '" ' . $rel . '>' . $term->name . '</a>';
|
||||
}
|
||||
if ( empty($tags) )
|
||||
return false;
|
||||
|
||||
return trim( join( $glue, $tags ) );
|
||||
} // end tag_ur_it
|
||||
if ( !empty($tlist) )
|
||||
return sprintf($text, join($glue, $tlist));
|
||||
return '';
|
||||
}
|
||||
|
||||
// Register widgetized areas
|
||||
function twentyten_widgets_init() {
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
<span class="meta-prep meta-prep-author"><?php _e( 'Posted on ', 'twentyten' ); ?></span>
|
||||
<a href="<?php the_permalink(); ?>" title="<?php the_time(); ?>" rel="bookmark"><span class="entry-date"><?php echo get_the_date(); ?></span></a>
|
||||
<span class="meta-sep"> <?php _e( 'by ', 'twentyten' ); ?> </span>
|
||||
<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>
|
||||
<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>
|
||||
</div><!-- .entry-meta -->
|
||||
|
||||
<div class="entry-content">
|
||||
|
@ -46,16 +46,22 @@
|
|||
|
||||
<?php } elseif ( in_category( 'asides' ) ) { ?>
|
||||
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
|
||||
<?php if ( is_archive() || is_search() ) : //Only display Excerpts for archives & search ?>
|
||||
<div class="entry-summary">
|
||||
<?php the_excerpt( __( 'Continue reading <span class="meta-nav">→</span>', 'twentyten' ) ); ?>
|
||||
</div><!-- .entry-summary -->
|
||||
<?php else : ?>
|
||||
<div class="entry-content">
|
||||
<?php the_content( __( 'Continue reading <span class="meta-nav">→</span>', 'twentyten' ) ); ?>
|
||||
</div><!-- .entry-content -->
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="entry-utility">
|
||||
<span class="meta-prep meta-prep-author"><?php _e( 'Posted on ', 'twentyten' ); ?></span>
|
||||
<a href="<?php the_permalink(); ?>" title="<?php the_time(); ?>" rel="bookmark"><span class="entry-date"><?php echo get_the_date(); ?></span></a>
|
||||
<span class="meta-sep"> <?php _e( ' by ', 'twentyten' ); ?> </span>
|
||||
<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>
|
||||
<span class="meta-sep"><?php __( ' | ', 'twentyten' ); ?></span>
|
||||
<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>
|
||||
<span class="meta-sep"><?php _e( ' | ', 'twentyten' ); ?></span>
|
||||
<span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'twentyten' ), __( '1 Comment', 'twentyten' ), __( '% Comments', 'twentyten' ) ); ?></span>
|
||||
<?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" ); ?>
|
||||
</div><!-- #entry-utility -->
|
||||
|
@ -71,7 +77,7 @@
|
|||
<a href="<?php
|
||||
the_permalink(); ?>" title="<?php the_time(); ?>" rel="bookmark"><span class="entry-date"><?php echo get_the_date(); ?></span></a>
|
||||
<span class="meta-sep"><?php _e( ' by ', 'twentyten' ); ?></span>
|
||||
<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>
|
||||
<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>
|
||||
</div><!-- .entry-meta -->
|
||||
|
||||
<?php if ( is_archive() || is_search() ) : //Only display Excerpts for archives & search ?>
|
||||
|
@ -86,9 +92,13 @@ the_permalink(); ?>" title="<?php the_time(); ?>" rel="bookmark"><span class="en
|
|||
<?php endif; ?>
|
||||
|
||||
<div class="entry-utility">
|
||||
<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>
|
||||
<span class="meta-sep"><?php __( ' | ', 'twentyten' ); ?></span>
|
||||
<?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" ); ?>
|
||||
<span class="cat-links"><span class="entry-utility-prep entry-utility-prep-cat-links"><?php echo twentyten_cat_list(); ?></span></span>
|
||||
<span class="meta-sep"><?php _e( ' | ', 'twentyten' ); ?></span>
|
||||
<?php $tags_text = twentyten_tag_list(); ?>
|
||||
<?php if ( !empty($tags_text) ) : ?>
|
||||
<span class="tag-links"><span class="entry-utility-prep entry-utility-prep-tag-links"><?php echo $tags_text; ?></span></span>
|
||||
<span class="meta-sep"><?php _e( ' | ', 'twentyten' ); ?></span>
|
||||
<?php endif; //$tags_text ?>
|
||||
<span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'twentyten' ), __( '1 Comment', 'twentyten' ), __( '% Comments', 'twentyten' ) ); ?></span>
|
||||
<?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" ); ?>
|
||||
</div><!-- #entry-utility -->
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
<div class="entry-meta">
|
||||
<span class="meta-prep meta-prep-author"><?php _e( 'Posted by ', 'twentyten' ); ?></span>
|
||||
<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>
|
||||
<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>
|
||||
<span class="meta-sep"><?php _e( ' on ', 'twentyten' ); ?> </span>
|
||||
<a href="<?php the_permalink(); ?>" title="<?php the_time(); ?>" rel="bookmark"><span class="entry-date"><?php echo get_the_date(); ?></span></a>
|
||||
<?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" ); ?>
|
||||
|
@ -35,7 +35,7 @@
|
|||
<h2><?php _e( 'About ', 'twentyten' ); ?><?php the_author(); ?></h2>
|
||||
<?php the_author_meta('description'); ?>
|
||||
<div id="author-link">
|
||||
<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(); ?> →</a>
|
||||
<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(); ?> →</a>
|
||||
</div><!-- #author-link -->
|
||||
</div><!-- #author-description -->
|
||||
</div><!-- .entry-author-info -->
|
||||
|
|
Loading…
Reference in New Issue