In Twenty Ten:

* removed custom functions for listing tags, cats, or other custom taxonomy terms.
* fixed up a couple of span tags meant to catch the text before tag and cat listings (for child themes)
* made attachment pages full width with a filterable size for the image, 'twentyten_attachment_size' (for child themes)
* removed "RSS for this post" in single.php.
clicking on attachment images in a gallery takes you to the next image, unless it's the last image in a gallery, in which case it points you back to the parent post.
* added a link to the full-size image in the post meta

Props iandstewart.

git-svn-id: http://svn.automattic.com/wordpress/trunk@14384 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
iammattthomas 2010-05-03 19:16:47 +00:00
parent e965a965d3
commit 941da09fa7
5 changed files with 55 additions and 93 deletions

View File

@ -34,6 +34,14 @@
esc_attr( get_the_time() ),
get_the_date()
);
if ( wp_attachment_is_image() ) {
$size = getimagesize( wp_get_attachment_url() );
printf( __( ' at <a href="%1$s" title="Link to full-size image">%2$s &times; %3$s</a>', 'twentyten'),
wp_get_attachment_url(),
$size[0],
$size[1]
);
}
?>
<?php edit_post_link( __( 'Edit', 'twentyten' ), '<span class="meta-sep">|</span> <span class="edit-link">', '</span>' ); ?>
</div><!-- .entry-meta -->
@ -41,8 +49,9 @@
<div class="entry-content">
<div class="entry-attachment">
<?php if ( wp_attachment_is_image() ) : ?>
<p class="attachment"><a href="<?php echo wp_get_attachment_url(); ?>" title="<?php echo esc_attr( get_the_title() ); ?>" rel="attachment"><?php
echo wp_get_attachment_image( $post->ID, array( $content_width, $content_width ) ); // max $content_width wide or high.
<p class="attachment"><a href="<?php echo twentyten_get_next_attachment_url(); ?>" title="<?php echo esc_attr( get_the_title() ); ?>" rel="attachment"><?php
$attachment_size = apply_filters( 'twentyten_attachment_size', 900 );
echo wp_get_attachment_image( $post->ID, array( $attachment_size, 9999 ) ); // filterable image width with, essentially, no limit for image height.
?></a></p>
<div id="nav-below" class="navigation">
@ -64,9 +73,9 @@
<?php
$tag_list = get_the_tag_list();
if ( '' != $tag_list ) {
$utility_text = __( 'This entry was posted in %1$s and tagged %2$s. Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>. Follow any comments here with the <a href="%5$s" title="Comments RSS to %4$s" rel="alternate" type="application/rss+xml">RSS feed for this post</a>.', 'twentyten' );
$utility_text = __( 'This entry was posted in %1$s and tagged %2$s. Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', 'twentyten' );
} else {
$utility_text = __( 'This entry was posted in %1$s. Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>. Follow any comments here with the <a href="%5$s" title="Comments RSS to %4$s" rel="alternate" type="application/rss+xml">RSS feed for this post</a>.', 'twentyten' );
$utility_text = __( 'This entry was posted in %1$s. Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', 'twentyten' );
}
printf(
$utility_text,
@ -96,5 +105,4 @@
</div><!-- #content -->
</div><!-- #container -->
<?php get_sidebar(); ?>
<?php get_footer(); ?>

View File

@ -284,77 +284,6 @@ function twentyten_comment( $comment, $args, $depth ) {
}
endif;
if ( ! function_exists( 'twentyten_cat_list' ) ) :
/**
* Returns the list of categories
*
* Returns the list of categories based on if we are or are
* not browsing a category archive page.
*
* @uses twentyten_term_list
*
* @return string
*/
function twentyten_cat_list() {
return twentyten_term_list( 'category', ', ', __( 'Posted in %s', 'twentyten' ), __( 'Also posted in %s', 'twentyten' ) );
}
endif;
if ( ! function_exists( 'twentyten_tag_list' ) ) :
/**
* Returns the list of tags
*
* Returns the list of tags based on if we are or are not
* browsing a tag archive page
*
* @uses twentyten_term_list
*
* @return string
*/
function twentyten_tag_list() {
return twentyten_term_list( 'post_tag', ', ', __( 'Tagged %s', 'twentyten' ), __( 'Also tagged %s', 'twentyten' ) );
}
endif;
if ( ! function_exists( 'twentyten_term_list' ) ) :
/**
* Returns the list of taxonomy items in multiple ways
*
* Returns the list of taxonomy items differently based on
* if we are browsing a term archive page or a different
* type of page. If browsing a term archive page and the
* post has no other taxonomied terms, it returns empty
*
* @return string
*/
function twentyten_term_list( $taxonomy, $glue = ', ', $text = '', $also_text = '' ) {
global $wp_query, $post;
$current_term = $wp_query->get_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;
}
$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( $tlist ) )
return sprintf( $text, join( $glue, $tlist ) );
return '';
}
endif;
/**
* Register widgetized areas, including two sidebars and four widget-ready columns in the footer.
*
@ -439,3 +368,24 @@ function twentyten_remove_recent_comments_style() {
remove_action( 'wp_head', array( $wp_widget_factory->widgets['WP_Widget_Recent_Comments'], 'recent_comments_style' ) );
}
add_action( 'widgets_init', 'twentyten_remove_recent_comments_style' );
/**
* Get the URL of the next image in a gallery for attachment pages
*/
function twentyten_get_next_attachment_url() {
global $post;
$post = get_post($post);
$attachments = array_values(get_children( array('post_parent' => $post->post_parent, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order ID') ));
foreach ( $attachments as $k => $attachment )
if ( $attachment->ID == $post->ID )
break;
$k = $k + 1;
if ( isset($attachments[$k]) ) {
return get_attachment_link($attachments[$k]->ID);
} else {
return get_permalink($post->post_parent);
}
}

View File

@ -142,13 +142,9 @@
<?php endif; ?>
<div class="entry-utility">
<span class="cat-links"><span class="entry-utility-prep entry-utility-prep-cat-links"><?php echo twentyten_cat_list(); ?></span></span>
<span class="cat-links"><span class="entry-utility-prep entry-utility-prep-cat-links"><?php _e( 'Posted in ', 'twentyten' ); ?></span><?php the_category( ', ' ); ?></span>
<span class="meta-sep"> | </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"> | </span>
<?php endif; //$tags_text ?>
<?php the_tags( '<span class="tag-links"><span class="entry-utility-prep entry-utility-prep-tag-links">' . __( 'Tagged ', 'twentyten' ) . '</span>', ', ', '<span class="meta-sep"> | </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> <span class="edit-link">', '</span>' ); ?>
</div><!-- #entry-utility -->

View File

@ -54,17 +54,16 @@
<?php
$tag_list = get_the_tag_list('', ', ');
if ( '' != $tag_list ) {
$utility_text = __( 'This entry was posted in %1$s and tagged %2$s. Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>. Follow any comments here with the <a href="%5$s" title="Comments RSS to %4$s" rel="alternate" type="application/rss+xml">RSS feed for this post</a>.', 'twentyten' );
$utility_text = __( 'This entry was posted in %1$s and tagged %2$s. Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', 'twentyten' );
} else {
$utility_text = __( 'This entry was posted in %1$s. Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>. Follow any comments here with the <a href="%5$s" title="Comments RSS to %4$s" rel="alternate" type="application/rss+xml">RSS feed for this post</a>.', 'twentyten' );
$utility_text = __( 'This entry was posted in %1$s. Bookmark the <a href="%3$s" title="Permalink to %4$s" rel="bookmark">permalink</a>.', 'twentyten' );
}
printf(
$utility_text,
get_the_category_list( ', ' ),
$tag_list,
get_permalink(),
the_title_attribute( 'echo=0' ),
get_post_comments_feed_link()
the_title_attribute( 'echo=0' )
);
?>

View File

@ -92,6 +92,15 @@ DESCRIPTION: One centered column with no sidebar
width: 640px;
}
/*
LAYOUT: Full width, no sidebar
DESCRIPTION: Full width content with no sidebar; used for attachment pages
*/
.single-attachment #content {
margin: 0 auto;
width: 900px;
}
/* =Fonts
@ -762,6 +771,9 @@ div.menu li {
margin: 0;
max-width: 640px;
}
.single-attachment #content img {
max-width: 900px;
}
#content .alignleft,
#content img.alignleft {
display: inline;
@ -811,7 +823,7 @@ div.menu li {
}
#content .gallery .gallery-item {
float: left;
margin-top: 10px;
margin-top: 0;
text-align: center;
width: 33%;
}
@ -819,7 +831,9 @@ div.menu li {
border: 2px solid #cfcfcf;
}
#content .gallery .gallery-caption {
margin-left: 0;
color: #888;
font-size: 12px;
margin: 0 0 12px;
}
#content .gallery dl {
margin: 0;
@ -827,11 +841,6 @@ div.menu li {
#content .gallery img {
border: 10px solid #f1f1f1;
}
#content .gallery-caption {
color: #888;
font-size: 12px;
margin:-24px 0 24px 0;
}
#content .gallery br+br {
display: none;
}