Make WordPress Core


Ignore:
Timestamp:
05/16/2010 08:53:36 PM (16 years ago)
Author:
nacin
Message:

Twenty Ten documentation and functions.php improvements. see #12695.

File:
1 edited

Legend:

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

    r14692 r14698  
    5959                    <div class="entry-content">
    6060                        <div class="entry-attachment">
    61 <?php if ( wp_attachment_is_image() ) : ?>
    62                         <p class="attachment"><a href="<?php echo twentyten_get_next_attachment_url(); ?>" title="<?php echo esc_attr( get_the_title() ); ?>" rel="attachment"><?php
     61<?php if ( wp_attachment_is_image() ) :
     62    $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' ) ) );
     63    foreach ( $attachments as $k => $attachment ) {
     64        if ( $attachment->ID == $post->ID )
     65            break;
     66    }
     67    $k++;
     68    if ( isset( $attachments[ $k ] ) )
     69        $next_attachment_url = get_attachment_link( $attachments[ $k ]->ID );
     70    else
     71        $next_attachment_url = get_permalink( $post->post_parent );
     72?>
     73                        <p class="attachment"><a href="<?php echo $next_attachment_url; ?>" title="<?php echo esc_attr( get_the_title() ); ?>" rel="attachment"><?php
    6374                            $attachment_size = apply_filters( 'twentyten_attachment_size', 900 );
    6475                            echo wp_get_attachment_image( $post->ID, array( $attachment_size, 9999 ) ); // filterable image width with, essentially, no limit for image height.
     
    8192
    8293                    <div class="entry-utility">
    83                         <?php echo twentyten_posted_in(); ?>
     94                        <?php twentyten_posted_in(); ?>
    8495                        <?php edit_post_link( __( 'Edit', 'twentyten' ), ' <span class="edit-link">', '</span>' ); ?>
    8596                    </div><!-- .entry-utility -->
Note: See TracChangeset for help on using the changeset viewer.