Make WordPress Core

Changeset 14384


Ignore:
Timestamp:
05/03/2010 07:16:47 PM (15 years ago)
Author:
iammattthomas
Message:

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.

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

Legend:

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

    r14037 r14384  
    3535                                get_the_date()
    3636                            );
     37                            if ( wp_attachment_is_image() ) {
     38                                $size = getimagesize( wp_get_attachment_url() );
     39                                printf( __( ' at <a href="%1$s" title="Link to full-size image">%2$s &times; %3$s</a>', 'twentyten'),
     40                                    wp_get_attachment_url(),
     41                                    $size[0],
     42                                    $size[1]
     43                                );
     44                            }                           
    3745                        ?>
    3846                        <?php edit_post_link( __( 'Edit', 'twentyten' ), '<span class="meta-sep">|</span> <span class="edit-link">', '</span>' ); ?>
     
    4250                        <div class="entry-attachment">
    4351<?php if ( wp_attachment_is_image() ) : ?>
    44                         <p class="attachment"><a href="<?php echo wp_get_attachment_url(); ?>" title="<?php echo esc_attr( get_the_title() ); ?>" rel="attachment"><?php
    45                             echo wp_get_attachment_image( $post->ID, array( $content_width, $content_width ) ); // max $content_width wide or high.
     52                        <p class="attachment"><a href="<?php echo twentyten_get_next_attachment_url(); ?>" title="<?php echo esc_attr( get_the_title() ); ?>" rel="attachment"><?php
     53                            $attachment_size = apply_filters( 'twentyten_attachment_size',  900 );
     54                            echo wp_get_attachment_image( $post->ID, array( $attachment_size, 9999 ) ); // filterable image width with, essentially, no limit for image height.
    4655                        ?></a></p>
    4756
     
    6574                        $tag_list = get_the_tag_list();
    6675                        if ( '' != $tag_list ) {
    67                             $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' );
     76                            $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' );
    6877                        } else {
    69                             $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' );
     78                            $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' );
    7079                        }
    7180                        printf(
     
    97106        </div><!-- #container -->
    98107
    99 <?php get_sidebar(); ?>
    100108<?php get_footer(); ?>
  • trunk/wp-content/themes/twentyten/functions.php

    r14374 r14384  
    285285endif;
    286286
    287 if ( ! function_exists( 'twentyten_cat_list' ) ) :
    288 /**
    289  * Returns the list of categories
    290  *
    291  * Returns the list of categories based on if we are or are
    292  * not browsing a category archive page.
    293  *
    294  * @uses twentyten_term_list
    295  *
    296  * @return string
    297  */
    298 function twentyten_cat_list() {
    299     return twentyten_term_list( 'category', ', ', __( 'Posted in %s', 'twentyten' ), __( 'Also posted in %s', 'twentyten' ) );
    300 }
    301 endif;
    302 
    303 if ( ! function_exists( 'twentyten_tag_list' ) ) :
    304 /**
    305  * Returns the list of tags
    306  *
    307  * Returns the list of tags based on if we are or are not
    308  * browsing a tag archive page
    309  *
    310  * @uses twentyten_term_list
    311  *
    312  * @return string
    313  */
    314 function twentyten_tag_list() {
    315     return twentyten_term_list( 'post_tag', ', ', __( 'Tagged %s', 'twentyten' ), __( 'Also tagged %s', 'twentyten' ) );
    316 }
    317 endif;
    318 
    319 
    320 if ( ! function_exists( 'twentyten_term_list' ) ) :
    321 /**
    322  * Returns the list of taxonomy items in multiple ways
    323  *
    324  * Returns the list of taxonomy items differently based on
    325  * if we are browsing a term archive page or a different
    326  * type of page.  If browsing a term archive page and the
    327  * post has no other taxonomied terms, it returns empty
    328  *
    329  * @return string
    330  */
    331 function twentyten_term_list( $taxonomy, $glue = ', ', $text = '', $also_text = '' ) {
    332     global $wp_query, $post;
    333     $current_term = $wp_query->get_queried_object();
    334     $terms = wp_get_object_terms( $post->ID, $taxonomy );
    335     // If we're viewing a Taxonomy page..
    336     if ( isset( $current_term->taxonomy ) && $taxonomy == $current_term->taxonomy ) {
    337         // Remove the term from display.
    338         foreach ( (array) $terms as $key => $term ) {
    339             if ( $term->term_id == $current_term->term_id ) {
    340                 unset( $terms[$key] );
    341                 break;
    342             }
    343         }
    344         // Change to Also text as we've now removed something from the terms list.
    345         $text = $also_text;
    346     }
    347     $tlist = array();
    348     $rel = 'category' == $taxonomy ? 'rel="category"' : 'rel="tag"';
    349     foreach ( (array) $terms as $term ) {
    350         $tlist[] = '<a href="' . get_term_link( $term, $taxonomy ) . '" title="' . esc_attr( sprintf( __( 'View all posts in %s', 'twentyten' ), $term->name ) ) . '" ' . $rel . '>' . $term->name . '</a>';
    351     }
    352     if ( ! empty( $tlist ) )
    353         return sprintf( $text, join( $glue, $tlist ) );
    354     return '';
    355 }
    356 endif;
    357 
    358287/**
    359288 * Register widgetized areas, including two sidebars and four widget-ready columns in the footer.
     
    440369}
    441370add_action( 'widgets_init', 'twentyten_remove_recent_comments_style' );
     371
     372/**
     373 * Get the URL of the next image in a gallery for attachment pages
     374 */
     375function twentyten_get_next_attachment_url() {
     376    global $post;
     377    $post = get_post($post);
     378    $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') ));
     379 
     380    foreach ( $attachments as $k => $attachment )
     381        if ( $attachment->ID == $post->ID )
     382            break;
     383
     384        $k = $k + 1;
     385 
     386        if ( isset($attachments[$k]) ) {
     387            return get_attachment_link($attachments[$k]->ID);       
     388        } else {
     389            return get_permalink($post->post_parent);
     390        }
     391}
  • trunk/wp-content/themes/twentyten/loop.php

    r14350 r14384  
    143143
    144144            <div class="entry-utility">
    145                 <span class="cat-links"><span class="entry-utility-prep entry-utility-prep-cat-links"><?php echo twentyten_cat_list(); ?></span></span>
     145                <span class="cat-links"><span class="entry-utility-prep entry-utility-prep-cat-links"><?php _e( 'Posted in ', 'twentyten' ); ?></span><?php the_category( ', ' ); ?></span>
    146146                <span class="meta-sep"> | </span>
    147                 <?php $tags_text = twentyten_tag_list(); ?>
    148                 <?php if ( ! empty( $tags_text ) ) : ?>
    149                 <span class="tag-links"><span class="entry-utility-prep entry-utility-prep-tag-links"><?php echo $tags_text; ?></span></span>
    150                 <span class="meta-sep"> | </span>
    151                 <?php endif; //$tags_text ?>
     147                <?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>' ); ?>
    152148                <span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'twentyten' ), __( '1 Comment', 'twentyten' ), __( '% Comments', 'twentyten' ) ); ?></span>
    153149                <?php edit_post_link( __( 'Edit', 'twentyten' ), '<span class="meta-sep">|</span> <span class="edit-link">', '</span>' ); ?>
  • trunk/wp-content/themes/twentyten/single.php

    r14289 r14384  
    5555                        $tag_list = get_the_tag_list('', ', ');
    5656                        if ( '' != $tag_list ) {
    57                             $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' );
     57                            $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' );
    5858                        } else {
    59                             $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' );
     59                            $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' );
    6060                        }
    6161                        printf(
     
    6464                            $tag_list,
    6565                            get_permalink(),
    66                             the_title_attribute( 'echo=0' ),
    67                             get_post_comments_feed_link()
     66                            the_title_attribute( 'echo=0' )
    6867                        );
    6968                    ?>
  • trunk/wp-content/themes/twentyten/style.css

    r14300 r14384  
    9393}
    9494
     95/*
     96LAYOUT: Full width, no sidebar
     97DESCRIPTION: Full width content with no sidebar; used for attachment pages
     98*/
     99
     100.single-attachment #content {
     101    margin: 0 auto;
     102    width: 900px;
     103}
    95104
    96105
     
    763772    max-width: 640px;
    764773}
     774.single-attachment #content img {
     775    max-width: 900px;
     776}
    765777#content .alignleft,
    766778#content img.alignleft {
     
    812824#content .gallery .gallery-item {
    813825    float: left;
    814     margin-top: 10px;
     826    margin-top: 0;
    815827    text-align: center;
    816828    width: 33%;
     
    820832}
    821833#content .gallery .gallery-caption {
    822     margin-left: 0;
     834    color: #888;
     835    font-size: 12px;
     836    margin: 0 0 12px;
    823837}
    824838#content .gallery dl {
     
    827841#content .gallery img {
    828842    border: 10px solid #f1f1f1;
    829 }
    830 #content .gallery-caption {
    831     color: #888;
    832     font-size: 12px;
    833     margin:-24px 0 24px 0;
    834843}
    835844#content .gallery br+br {
Note: See TracChangeset for help on using the changeset viewer.