web/wp-content/themes/twentyeleven/content-gallery.php
changeset 194 32102edaa81b
child 204 09a1c134465b
equal deleted inserted replaced
193:2f6f6f7551ca 194:32102edaa81b
       
     1 <?php
       
     2 /**
       
     3  * The template for displaying posts in the Gallery Post Format on index and archive pages
       
     4  *
       
     5  * Learn more: http://codex.wordpress.org/Post_Formats
       
     6  *
       
     7  * @package WordPress
       
     8  * @subpackage Twenty_Eleven
       
     9  * @since Twenty Eleven 1.0
       
    10  */
       
    11 ?>
       
    12 
       
    13 <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
       
    14 	<header class="entry-header">
       
    15 		<hgroup>
       
    16 			<h2 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyeleven' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
       
    17 			<h3 class="entry-format"><?php _e( 'Gallery', 'twentyeleven' ); ?></h3>
       
    18 		</hgroup>
       
    19 
       
    20 		<div class="entry-meta">
       
    21 			<?php twentyeleven_posted_on(); ?>
       
    22 		</div><!-- .entry-meta -->
       
    23 	</header><!-- .entry-header -->
       
    24 
       
    25 	<?php if ( is_search() ) : // Only display Excerpts for search pages ?>
       
    26 		<div class="entry-summary">
       
    27 			<?php the_excerpt(); ?>
       
    28 		</div><!-- .entry-summary -->
       
    29 		<?php else : ?>
       
    30 		<div class="entry-content">
       
    31 			<?php if ( post_password_required() ) : ?>
       
    32 				<?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentyeleven' ) ); ?>
       
    33 
       
    34 			<?php else : ?>
       
    35 				<?php
       
    36 					$images = get_children( array( 'post_parent' => $post->ID, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'orderby' => 'menu_order', 'order' => 'ASC', 'numberposts' => 999 ) );
       
    37 					if ( $images ) :
       
    38 						$total_images = count( $images );
       
    39 						$image = array_shift( $images );
       
    40 						$image_img_tag = wp_get_attachment_image( $image->ID, 'thumbnail' );
       
    41 				?>
       
    42 
       
    43 				<figure class="gallery-thumb">
       
    44 					<a href="<?php the_permalink(); ?>"><?php echo $image_img_tag; ?></a>
       
    45 				</figure><!-- .gallery-thumb -->
       
    46 
       
    47 				<p><em><?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, 'twentyeleven' ),
       
    48 						'href="' . esc_url( get_permalink() ) . '" title="' . sprintf( esc_attr__( 'Permalink to %s', 'twentyeleven' ), the_title_attribute( 'echo=0' ) ) . '" rel="bookmark"',
       
    49 						number_format_i18n( $total_images )
       
    50 					); ?></em></p>
       
    51 			<?php endif; ?>
       
    52 			<?php the_excerpt(); ?>
       
    53 		<?php endif; ?>
       
    54 		<?php wp_link_pages( array( 'before' => '<div class="page-link"><span>' . __( 'Pages:', 'twentyeleven' ) . '</span>', 'after' => '</div>' ) ); ?>
       
    55 	</div><!-- .entry-content -->
       
    56 	<?php endif; ?>
       
    57 
       
    58 	<footer class="entry-meta">
       
    59 		<?php $show_sep = false; ?>
       
    60 		<?php
       
    61 			/* translators: used between list items, there is a space after the comma */
       
    62 			$categories_list = get_the_category_list( __( ', ', 'twentyeleven' ) );
       
    63 			if ( $categories_list ):
       
    64 		?>
       
    65 		<span class="cat-links">
       
    66 			<?php printf( __( '<span class="%1$s">Posted in</span> %2$s', 'twentyeleven' ), 'entry-utility-prep entry-utility-prep-cat-links', $categories_list );
       
    67 			$show_sep = true; ?>
       
    68 		</span>
       
    69 		<?php endif; // End if categories ?>
       
    70 		<?php
       
    71 			/* translators: used between list items, there is a space after the comma */
       
    72 			$tags_list = get_the_tag_list( '', __( ', ', 'twentyeleven' ) );
       
    73 			if ( $tags_list ):
       
    74 			if ( $show_sep ) : ?>
       
    75 		<span class="sep"> | </span>
       
    76 			<?php endif; // End if $show_sep ?>
       
    77 		<span class="tag-links">
       
    78 			<?php printf( __( '<span class="%1$s">Tagged</span> %2$s', 'twentyeleven' ), 'entry-utility-prep entry-utility-prep-tag-links', $tags_list );
       
    79 			$show_sep = true; ?>
       
    80 		</span>
       
    81 		<?php endif; // End if $tags_list ?>
       
    82 
       
    83 		<?php if ( comments_open() ) : ?>
       
    84 		<?php if ( $show_sep ) : ?>
       
    85 		<span class="sep"> | </span>
       
    86 		<?php endif; // End if $show_sep ?>
       
    87 		<span class="comments-link"><?php comments_popup_link( '<span class="leave-reply">' . __( 'Leave a reply', 'twentyeleven' ) . '</span>', __( '<b>1</b> Reply', 'twentyeleven' ), __( '<b>%</b> Replies', 'twentyeleven' ) ); ?></span>
       
    88 		<?php endif; // End if comments_open() ?>
       
    89 
       
    90 		<?php edit_post_link( __( 'Edit', 'twentyeleven' ), '<span class="edit-link">', '</span>' ); ?>
       
    91 	</footer><!-- #entry-meta -->
       
    92 </article><!-- #post-<?php the_ID(); ?> -->