[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

/wp-content/themes/twentyeleven/ -> content-gallery.php (source)

   1  <?php
   2  /**
   3   * Template for displaying posts in the Gallery Post Format
   4   *
   5   * Used on index and archive pages.
   6   *
   7   * @link https://wordpress.org/support/article/post-formats/
   8   *
   9   * @package WordPress
  10   * @subpackage Twenty_Eleven
  11   * @since Twenty Eleven 1.0
  12   */
  13  ?>
  14  
  15  <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
  16      <header class="entry-header">
  17          <hgroup>
  18              <h2 class="entry-title"><a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
  19              <h3 class="entry-format"><?php _e( 'Gallery', 'twentyeleven' ); ?></h3>
  20          </hgroup>
  21  
  22          <div class="entry-meta">
  23              <?php twentyeleven_posted_on(); ?>
  24          </div><!-- .entry-meta -->
  25      </header><!-- .entry-header -->
  26  
  27      <?php if ( is_search() ) : // Only display excerpts for search. ?>
  28          <div class="entry-summary">
  29              <?php the_excerpt(); ?>
  30          </div><!-- .entry-summary -->
  31          <?php else : ?>
  32          <div class="entry-content">
  33              <?php if ( post_password_required() ) : ?>
  34                  <?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'twentyeleven' ) ); ?>
  35                  <?php
  36              else :
  37                  $images = twentyeleven_get_gallery_images();
  38                  if ( $images ) :
  39                      $total_images = count( $images );
  40                      $image        = reset( $images );
  41                      ?>
  42                  <figure class="gallery-thumb">
  43                      <a href="<?php the_permalink(); ?>"><?php echo wp_get_attachment_image( $image, 'thumbnail' ); ?></a>
  44      </figure><!-- .gallery-thumb -->
  45  
  46      <p><em>
  47                      <?php
  48                      printf(
  49                          /* translators: 1: Link attributes, 2: Number of photos. */
  50                          _n( 'This gallery contains <a %1$s>%2$s photo</a>.', 'This gallery contains <a %1$s>%2$s photos</a>.', $total_images, 'twentyeleven' ),
  51                          /* translators: %s: Post title. */
  52                          'href="' . esc_url( get_permalink() ) . '" title="' . esc_attr( sprintf( __( 'Permalink to %s', 'twentyeleven' ), the_title_attribute( 'echo=0' ) ) ) . '" rel="bookmark"',
  53                          number_format_i18n( $total_images )
  54                      );
  55                      ?>
  56                      </em></p>
  57                          <?php endif; // End twentyeleven_get_gallery_images() check. ?>
  58                  <?php the_excerpt(); ?>
  59          <?php endif; ?>
  60              <?php
  61              wp_link_pages(
  62                  array(
  63                      'before' => '<div class="page-link"><span>' . __( 'Pages:', 'twentyeleven' ) . '</span>',
  64                      'after'  => '</div>',
  65                  )
  66              );
  67              ?>
  68      </div><!-- .entry-content -->
  69      <?php endif; ?>
  70  
  71      <footer class="entry-meta">
  72          <?php $show_sep = false; ?>
  73  
  74          <?php
  75          $categories_list = get_the_category_list( wp_get_list_item_separator() );
  76  
  77          if ( $categories_list ) :
  78              ?>
  79          <span class="cat-links">
  80              <?php
  81              /* translators: 1: CSS classes, 2: List of categories. */
  82              printf( __( '<span class="%1$s">Posted in</span> %2$s', 'twentyeleven' ), 'entry-utility-prep entry-utility-prep-cat-links', $categories_list );
  83              $show_sep = true;
  84              ?>
  85          </span>
  86          <?php endif; // End if categories. ?>
  87  
  88          <?php
  89          $tags_list = get_the_tag_list( '', wp_get_list_item_separator() );
  90  
  91          if ( $tags_list && ! is_wp_error( $tags_list ) ) :
  92              if ( $show_sep ) :
  93                  ?>
  94          <span class="sep"> | </span>
  95              <?php endif; // End if $show_sep. ?>
  96          <span class="tag-links">
  97              <?php
  98              /* translators: 1: CSS classes, 2: List of tags. */
  99              printf( __( '<span class="%1$s">Tagged</span> %2$s', 'twentyeleven' ), 'entry-utility-prep entry-utility-prep-tag-links', $tags_list );
 100              $show_sep = true;
 101              ?>
 102          </span>
 103          <?php endif; // End if $tags_list. ?>
 104  
 105          <?php if ( comments_open() ) : ?>
 106              <?php if ( $show_sep ) : ?>
 107          <span class="sep"> | </span>
 108          <?php endif; // End if $show_sep. ?>
 109          <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>
 110          <?php endif; // End if comments_open(). ?>
 111  
 112          <?php edit_post_link( __( 'Edit', 'twentyeleven' ), '<span class="edit-link">', '</span>' ); ?>
 113      </footer><!-- .entry-meta -->
 114  </article><!-- #post-<?php the_ID(); ?> -->


Generated: Sat Dec 7 01:00:02 2024 Cross-referenced by PHPXref 0.7.1