From 941da09fa7fcfc49ce0c216e29dd7742ee3d2e27 Mon Sep 17 00:00:00 2001 From: iammattthomas Date: Mon, 3 May 2010 19:16:47 +0000 Subject: [PATCH] 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 --- wp-content/themes/twentyten/attachment.php | 18 +++-- wp-content/themes/twentyten/functions.php | 92 +++++----------------- wp-content/themes/twentyten/loop.php | 8 +- wp-content/themes/twentyten/single.php | 7 +- wp-content/themes/twentyten/style.css | 23 ++++-- 5 files changed, 55 insertions(+), 93 deletions(-) diff --git a/wp-content/themes/twentyten/attachment.php b/wp-content/themes/twentyten/attachment.php index 9e85733492..8676fda9f9 100644 --- a/wp-content/themes/twentyten/attachment.php +++ b/wp-content/themes/twentyten/attachment.php @@ -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 %2$s × %3$s', 'twentyten'), + wp_get_attachment_url(), + $size[0], + $size[1] + ); + } ?> | ', '' ); ?> @@ -41,8 +49,9 @@
-

ID, array( $content_width, $content_width ) ); // max $content_width wide or high. +

ID, array( $attachment_size, 9999 ) ); // filterable image width with, essentially, no limit for image height. ?>

- diff --git a/wp-content/themes/twentyten/functions.php b/wp-content/themes/twentyten/functions.php index c25b8c5ce7..cd76572e19 100644 --- a/wp-content/themes/twentyten/functions.php +++ b/wp-content/themes/twentyten/functions.php @@ -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[] = '' . $term->name . ''; - } - 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); + } +} \ No newline at end of file diff --git a/wp-content/themes/twentyten/loop.php b/wp-content/themes/twentyten/loop.php index 26aceddb7a..a3cbd63116 100644 --- a/wp-content/themes/twentyten/loop.php +++ b/wp-content/themes/twentyten/loop.php @@ -142,13 +142,9 @@
- + | - - - - | - + ' . __( 'Tagged ', 'twentyten' ) . '', ', ', ' | ' ); ?> | ', '' ); ?>
diff --git a/wp-content/themes/twentyten/single.php b/wp-content/themes/twentyten/single.php index ea91fb375f..97144a4410 100644 --- a/wp-content/themes/twentyten/single.php +++ b/wp-content/themes/twentyten/single.php @@ -54,17 +54,16 @@ permalink. Follow any comments here with the RSS feed for this post.', 'twentyten' ); + $utility_text = __( 'This entry was posted in %1$s and tagged %2$s. Bookmark the permalink.', 'twentyten' ); } else { - $utility_text = __( 'This entry was posted in %1$s. Bookmark the permalink. Follow any comments here with the RSS feed for this post.', 'twentyten' ); + $utility_text = __( 'This entry was posted in %1$s. Bookmark the permalink.', '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' ) ); ?> diff --git a/wp-content/themes/twentyten/style.css b/wp-content/themes/twentyten/style.css index ff6d66cb04..8a49425e8c 100644 --- a/wp-content/themes/twentyten/style.css +++ b/wp-content/themes/twentyten/style.css @@ -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; }