- Timestamp:
- 08/14/2013 04:38:01 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-content/themes/twentyfourteen/content-recent-formatted-post.php
r24832 r25021 7 7 $GLOBALS['content_width'] = 306; 8 8 9 $format = get_post_format(); 10 if ( false === $format ) 11 $format = 'standard'; 9 $images = get_posts( array( 10 'post_parent' => get_post()->post_parent, 11 'fields' => 'ids', 12 'numberposts' => -1, 13 'post_status' => 'inherit', 14 'post_type' => 'attachment', 15 'post_mime_type' => 'image', 16 'order' => 'ASC', 17 'orderby' => 'menu_order ID' 18 ) ); 19 $total_images = count( $images ); 12 20 ?> 13 21 14 <article id="post-<?php the_ID(); ?>" <?php post_class( 'clearfix'); ?>>15 <div class="entry-content clearfix">22 <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> 23 <div class="entry-content"> 16 24 <?php 17 if ( 'gallery' == $format ) : 18 $featured_image = get_the_post_thumbnail( get_the_ID(), 'featured-thumbnail-formatted' ); 19 $images = get_children( array( 'post_parent' => $post->ID, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'orderby' => 'menu_order', 'order' => 'ASC' ) ); 20 if ( $images ) : 21 $total_images = count( $images ); 22 if ( empty( $featured_image ) ) { 23 $image = array_shift( $images ); 24 $featured_image = wp_get_attachment_image( $image->ID, 'featured-thumbnail-formatted' ); 25 } 25 if ( has_post_format( 'gallery' ) ) : 26 if ( has_post_thumbnail() ) : 27 $featured_image = get_the_post_thumbnail( get_the_ID(), 'featured-thumbnail-formatted' ); 28 elseif ( $total_images > 0 ) : 29 $image = array_shift( $images ); 30 $featured_image = wp_get_attachment_image( $image, 'featured-thumbnail-formatted' ); 26 31 ?> 27 <a href="<?php the_permalink(); ?>"><?php echo $featured_image; ?></a> 28 <p class="wp-caption-text"><?php printf( _n( 'This gallery contains <a %1$s>%2$s photo</a>.', 'This gallery contains <a %1$s>%2$s photos</a>.', $total_images, 'twentyfourteen' ), 29 'href="' . get_permalink() . '" title="' . esc_attr( sprintf( __( 'Permalink to %s', 'twentyfourteen' ), the_title_attribute( 'echo=0' ) ) ) . '" rel="bookmark"', 32 <a href="<?php the_permalink(); ?>"><?php echo $featured_image; ?></a> 33 <p class="wp-caption-text"> 34 <?php 35 printf( _n( 'This gallery contains <a href="%1$s" rel="bookmark">%2$s photo</a>.', 'This gallery contains <a href="%1$s" rel="bookmark">%2$s photos</a>.', $total_images, 'twentyfourteen' ), 36 esc_url( get_permalink() ), 30 37 number_format_i18n( $total_images ) 31 ); ?></p><?php 38 ); 39 ?> 40 </p> 41 <?php 32 42 else : 33 43 the_excerpt(); … … 42 52 <div class="entry-meta"> 43 53 <?php 44 if ( 'link' != $format) :45 the_title( '<h1 class="entry-title"><a href="' . get_permalink() . '" title="' . esc_attr( sprintf( __( 'Permalink to %s', 'twentyfourteen' ), the_title_attribute( 'echo=0' )) ) . '" rel="bookmark">', '</a></h1>' );54 if ( ! has_post_format( 'link' ) ) : 55 the_title( '<h1 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark">', '</a></h1>' ); 46 56 endif; 57 58 twentyfourteen_posted_on(); 59 60 if ( ! post_password_required() && ( comments_open() || get_comments_number() ) ) : 47 61 ?> 48 <?php twentyfourteen_posted_on(); ?>49 <?php if ( ! post_password_required() && ( comments_open() || '0' != get_comments_number() ) ) : ?>50 62 <span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'twentyfourteen' ), __( '1 Comment', 'twentyfourteen' ), __( '% Comments', 'twentyfourteen' ) ); ?></span> 51 63 <?php endif; ?> 52 64 </div><!-- .entry-meta --> 53 65 </header><!-- .entry-header --> 54 </article> 66 </article><!-- #post-## -->
Note: See TracChangeset
for help on using the changeset viewer.