Advertisement
catchmahesh

content-gallery.php

Apr 11th, 2017
235
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.48 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 Catch Themes
  8.  * @subpackage Catch_Evolution_Pro
  9.  * @since Catch Evolution 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', 'catch-evolution' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
  17.             <h3 class="entry-format"><?php _e( 'Gallery', 'catch-evolution' ); ?></h3>
  18.         </hgroup>
  19.  
  20.         <div class="entry-meta">
  21.             <?php catchevolution_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>', 'catch-evolution' ) ); ?>
  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.                 <?php if( has_shortcode( $post->post_content, 'gallery' ) ):
  44.                     $gallery = get_post_gallery_images( $post );
  45.                 ?>
  46.                
  47.                 <figure class="gallery-thumb">
  48.                         <a href="<?php the_permalink(); ?>"><img class="attachment-thumbnail size-thumbnail" src="<?php echo $gallery[0]; ?>" alt="" width="90" height="68"></a>
  49.                     </figure><!-- .gallery-thumb -->
  50.                 <?php else:  ?>
  51.  
  52.                 <figure class="gallery-thumb">
  53.                     <a href="<?php the_permalink(); ?>"><?php echo $image_img_tag; ?></a>
  54.                 </figure><!-- .gallery-thumb -->
  55.                 <?php endif; ?>
  56.  
  57.                 <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, 'catch-evolution' ),
  58.                         'href="' . esc_url( get_permalink() ) . '" title="' . sprintf( esc_attr__( 'Permalink to %s', 'catch-evolution' ), the_title_attribute( 'echo=0' ) ) . '" rel="bookmark"',
  59.                         number_format_i18n( $total_images )
  60.                     ); ?></em></p>
  61.             <?php endif; ?>
  62.             <?php the_excerpt(); ?>
  63.         <?php endif; ?>
  64.         <?php wp_link_pages( array(
  65.             'before'        => '<div class="page-link"><span class="pages">' . __( 'Pages:', 'catch-evolution' ) . '</span>',
  66.             'after'         => '</div>',
  67.             'link_before'   => '<span>',
  68.             'link_after'    => '</span>',
  69.         ) );
  70.         ?>
  71.     </div><!-- .entry-content -->
  72.     <?php endif; ?>
  73.  
  74.     <footer class="entry-meta">
  75.         <?php $show_sep = false; ?>
  76.         <?php
  77.             /* translators: used between list items, there is a space after the comma */
  78.             $categories_list = get_the_category_list( __( ', ', 'catch-evolution' ) );
  79.             if ( $categories_list ):
  80.         ?>
  81.         <span class="cat-links">
  82.             <?php printf( __( '<span class="%1$s">Posted in</span> %2$s', 'catch-evolution' ), 'entry-utility-prep entry-utility-prep-cat-links', $categories_list );
  83.             $show_sep = true; ?>
  84.         </span>
  85.         <?php endif; // End if categories ?>
  86.         <?php
  87.             /* translators: used between list items, there is a space after the comma */
  88.             $tags_list = get_the_tag_list( '', __( ', ', 'catch-evolution' ) );
  89.             if ( $tags_list ):
  90.             if ( $show_sep ) : ?>
  91.         <span class="sep"> | </span>
  92.             <?php endif; // End if $show_sep ?>
  93.         <span class="tag-links">
  94.             <?php printf( __( '<span class="%1$s">Tagged</span> %2$s', 'catch-evolution' ), 'entry-utility-prep entry-utility-prep-tag-links', $tags_list );
  95.             $show_sep = true; ?>
  96.         </span>
  97.         <?php endif; // End if $tags_list ?>
  98.  
  99.         <?php if ( comments_open() ) : ?>
  100.         <?php if ( $show_sep ) : ?>
  101.         <span class="sep"> | </span>
  102.         <?php endif; // End if $show_sep ?>
  103.         <span class="comments-link"><?php comments_popup_link(__('Leave a reply', 'catch-evolution'), __('1 Comment &darr;', 'catch-evolution'), __('% Comments &darr;', 'catch-evolution')); ?></span>
  104.         <?php endif; // End if comments_open() ?>
  105.  
  106.         <?php edit_post_link( __( 'Edit', 'catch-evolution' ), '<span class="edit-link">', '</span>' ); ?>
  107.     </footer><!-- #entry-meta -->
  108. </article><!-- #post-<?php the_ID(); ?> -->
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement