Guest User

Untitled

a guest
Mar 28th, 2013
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 6.06 KB | None | 0 0
  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_Twelve
  9.  */
  10. ?>
  11.  
  12. <?php if( is_single() ) { get_template_part( 'content' ); return; } //force normal single view of a 'gallery' post format ?>
  13.  
  14. <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
  15.                 <header class="entry-header">
  16.                         <?php if( is_single() ) { the_post_thumbnail(); } else { ?><a href="<?php the_permalink(); ?>"><?php the_post_thumbnail(); ?></a><?php } ?>
  17.                         <?php if ( is_single() ) : ?>
  18.                         <h1 class="entry-title"><?php the_title(); ?></h1>
  19.                         <?php else : ?>
  20.                         <h1 class="entry-title">
  21.                                 <a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( sprintf( __( 'Permalink to %s', 'twentytwelve' ), the_title_attribute( 'echo=0' ) ) ); ?>" rel="bookmark"><?php the_title(); ?></a>
  22.                         </h1>
  23.                         <?php endif; // is_single() ?>
  24.                         <?php if ( comments_open() ) : ?>
  25.                                 <div class="comments-link">
  26.                                         <?php comments_popup_link( '<span class="leave-reply">' . __( 'Leave a reply', 'twentytwelve' ) . '</span>', __( '1 Reply', 'twentytwelve' ), __( '% Replies', 'twentytwelve' ) ); ?>
  27.                                 </div><!-- .comments-link -->
  28.                         <?php endif; // comments_open() ?>
  29.                 </header><!-- .entry-header -->
  30.  
  31.         <?php if ( is_search() ) : // Only display Excerpts for search pages ?>
  32.                 <div class="entry-summary">
  33.                         <?php the_excerpt(); ?>
  34.                 </div><!-- .entry-summary -->
  35.                 <?php else : ?>
  36.                 <div class="entry-content">
  37.                         <?php if ( post_password_required() ) : ?>
  38.                                 <?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentytwelve' ) ); ?>
  39.  
  40.                         <?php else : ?>
  41.                                 <?php
  42.                                         $images = get_children( array( 'post_parent' => $post->ID, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'orderby' => 'menu_order', 'order' => 'ASC', 'numberposts' => 999 ) );
  43.                                         if ( $images ) :
  44.                                                 $total_images = count( $images );
  45.                                                 $image = array_shift( $images );
  46.                                                 $image_img_tag = wp_get_attachment_image( $image->ID, 'thumbnail' );
  47.                                 ?>
  48.  
  49.                                 <figure class="gallery-thumb">
  50.                                         <a href="<?php the_permalink(); ?>"><?php echo $image_img_tag; ?></a>
  51.                                 </figure><!-- .gallery-thumb -->
  52.  
  53.                                 <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, 'twentytwelve' ),
  54.                                                 'href="' . esc_url( get_permalink() ) . '" title="' . esc_attr( sprintf( __( 'Permalink to %s', 'twentytwelve' ), the_title_attribute( 'echo=0' ) ) ) . '" rel="bookmark"',
  55.                                                 number_format_i18n( $total_images )
  56.                                         ); ?></em></p>
  57.                         <?php endif; ?>
  58.                         <?php the_excerpt(); ?>
  59.                 <?php endif; ?>
  60.                 <?php wp_link_pages( array( 'before' => '<div class="page-link"><span>' . __( 'Pages:', 'twentytwelve' ) . '</span>', 'after' => '</div>' ) ); ?>
  61.         </div><!-- .entry-content -->
  62.         <?php endif; ?>
  63.  
  64.         <footer class="entry-meta">
  65.                 <?php $show_sep = false; ?>
  66.                 <?php
  67.                         /* translators: used between list items, there is a space after the comma */
  68.                         $categories_list = get_the_category_list( __( ', ', 'twentytwelve' ) );
  69.                         if ( $categories_list ):
  70.                 ?>
  71.                 <span class="cat-links">
  72.                         <?php printf( __( '<span class="%1$s">Posted in</span> %2$s', 'twentytwelve' ), 'entry-utility-prep entry-utility-prep-cat-links', $categories_list );
  73.                         $show_sep = true; ?>
  74.                 </span>
  75.                 <?php endif; // End if categories ?>
  76.                 <?php
  77.                         /* translators: used between list items, there is a space after the comma */
  78.                         $tags_list = get_the_tag_list( '', __( ', ', 'twentytwelve' ) );
  79.                         if ( $tags_list ):
  80.                         if ( $show_sep ) : ?>
  81.                 <span class="sep"> | </span>
  82.                         <?php endif; // End if $show_sep ?>
  83.                 <span class="tag-links">
  84.                         <?php printf( __( '<span class="%1$s">Tagged</span> %2$s', 'twentytwelve' ), 'entry-utility-prep entry-utility-prep-tag-links', $tags_list );
  85.                         $show_sep = true; ?>
  86.                 </span>
  87.                 <?php endif; // End if $tags_list ?>
  88.  
  89.                 <?php if ( comments_open() ) : ?>
  90.                 <?php if ( $show_sep ) : ?>
  91.                 <span class="sep"> | </span>
  92.                 <?php endif; // End if $show_sep ?>
  93.                 <span class="comments-link"><?php comments_popup_link( '<span class="leave-reply">' . __( 'Leave a reply', 'twentytwelve' ) . '</span>', __( '<b>1</b> Reply', 'twentytwelve' ), __( '<b>%</b> Replies', 'twentytwelve' ) ); ?></span>
  94.                 <?php endif; // End if comments_open() ?>
  95.  
  96.                 <?php edit_post_link( __( 'Edit', 'twentytwelve' ), '<span class="edit-link">', '</span>' ); ?>
  97.         </footer><!-- .entry-meta -->
  98. </article><!-- #post-<?php the_ID(); ?> -->
Add Comment
Please, Sign In to add comment