Changeset 24537
- Timestamp:
- 07/01/2013 05:27:41 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-content/themes/twentythirteen/functions.php
r24516 r24537 35 35 * Adds support for a custom header image. 36 36 */ 37 require ( get_template_directory() . '/inc/custom-header.php' );37 require get_template_directory() . '/inc/custom-header.php'; 38 38 39 39 /** … … 41 41 */ 42 42 if ( version_compare( $GLOBALS['wp_version'], '3.6-alpha', '<' ) ) 43 require ( get_template_directory() . '/inc/back-compat.php' );43 require get_template_directory() . '/inc/back-compat.php'; 44 44 45 45 /** … … 275 275 'name' => __( 'Main Widget Area', 'twentythirteen' ), 276 276 'id' => 'sidebar-1', 277 'description' => __( 'Appears in the footer section of the site ', 'twentythirteen' ),277 'description' => __( 'Appears in the footer section of the site.', 'twentythirteen' ), 278 278 'before_widget' => '<aside id="%1$s" class="widget %2$s">', 279 279 'after_widget' => '</aside>', … … 306 306 307 307 // Don't print empty markup if there's only one page. 308 if ( $wp_query->max_num_pages < 2 && ( is_home() || is_archive() || is_search() ))308 if ( $wp_query->max_num_pages < 2 ) 309 309 return; 310 310 ?> … … 340 340 // Don't print empty markup if there's nowhere to navigate. 341 341 $previous = ( is_attachment() ) ? get_post( $post->post_parent ) : get_adjacent_post( false, '', true ); 342 $next = get_adjacent_post( false, '', false );342 $next = get_adjacent_post( false, '', false ); 343 343 344 344 if ( ! $next && ! $previous ) … … 445 445 * link to that image file. 446 446 */ 447 $attachment s = array_values( get_children( array(447 $attachment_ids = get_posts( array( 448 448 'post_parent' => $post->post_parent, 449 'fields' => 'ids', 450 'numberposts' => -1, 449 451 'post_status' => 'inherit', 450 452 'post_type' => 'attachment', … … 452 454 'order' => 'ASC', 453 455 'orderby' => 'menu_order ID' 454 ) ) );456 ) ); 455 457 456 458 // If there is more than 1 attachment in a gallery... 457 if ( count( $attachments ) > 1 ) { 458 foreach ( $attachments as $k => $attachment ) { 459 if ( $attachment->ID == $post->ID ) 459 if ( count( $attachment_ids ) > 1 ) { 460 foreach ( $attachment_ids as $attachment_id ) { 461 if ( $attachment_id == $post->ID ) { 462 $next_id = current( $attachment_ids ); 460 463 break; 464 } 461 465 } 462 $k++;463 466 464 467 // get the URL of the next image attachment... 465 if ( isset( $attachments[ $k ] ))466 $next_attachment_url = get_attachment_link( $ attachments[ $k ]->ID);468 if ( $next_id ) 469 $next_attachment_url = get_attachment_link( $next_id ); 467 470 468 471 // or get the URL of the first image attachment. 469 472 else 470 $next_attachment_url = get_attachment_link( $attachments[0]->ID);473 $next_attachment_url = get_attachment_link( array_shift( $attachment_ids ) ); 471 474 } 472 475
Note: See TracChangeset
for help on using the changeset viewer.