PageRenderTime 39ms CodeModel.GetById 12ms RepoModel.GetById 0ms app.codeStats 0ms

/wp-content/themes/catch-box/content-gallery.php

https://github.com/ActivateNY/activateny.org
PHP | 98 lines | 78 code | 9 blank | 11 comment | 10 complexity | 6e13a690ffd7edb32973ce05b35899e1 MD5 | raw file
Possible License(s): GPL-2.0, AGPL-1.0, LGPL-2.1
  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_Box
  9. * @since Catch Box 1.0
  10. */
  11. ?>
  12. <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
  13. <header class="entry-header">
  14. <hgroup>
  15. <h2 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'catchbox' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
  16. <h3 class="entry-format"><?php _e( 'Gallery', 'catchbox' ); ?></h3>
  17. </hgroup>
  18. <div class="entry-meta">
  19. <?php catchbox_posted_on(); ?>
  20. </div><!-- .entry-meta -->
  21. </header><!-- .entry-header -->
  22. <?php if ( is_search() ) : // Only display Excerpts for search pages ?>
  23. <div class="entry-summary">
  24. <?php the_excerpt(); ?>
  25. </div><!-- .entry-summary -->
  26. <?php else : ?>
  27. <div class="entry-content">
  28. <?php if ( post_password_required() ) : ?>
  29. <?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'catchbox' ) ); ?>
  30. <?php else : ?>
  31. <?php
  32. $images = get_children( array( 'post_parent' => $post->ID, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'orderby' => 'menu_order', 'order' => 'ASC', 'numberposts' => 999 ) );
  33. if ( $images ) :
  34. $total_images = count( $images );
  35. $image = array_shift( $images );
  36. $image_img_tag = wp_get_attachment_image( $image->ID, 'thumbnail' );
  37. ?>
  38. <figure class="gallery-thumb">
  39. <a href="<?php the_permalink(); ?>"><?php echo $image_img_tag; ?></a>
  40. </figure><!-- .gallery-thumb -->
  41. <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, 'catchbox' ),
  42. 'href="' . esc_url( get_permalink() ) . '" title="' . sprintf( esc_attr__( 'Permalink to %s', 'catchbox' ), the_title_attribute( 'echo=0' ) ) . '" rel="bookmark"',
  43. number_format_i18n( $total_images )
  44. ); ?></em></p>
  45. <?php endif; ?>
  46. <?php the_excerpt(); ?>
  47. <?php endif; ?>
  48. <?php wp_link_pages( array(
  49. 'before' => '<div class="page-link"><span class="pages">' . __( 'Pages:', 'catchbox' ) . '</span>',
  50. 'after' => '</div>',
  51. 'link_before' => '<span>',
  52. 'link_after' => '</span>',
  53. ) );
  54. ?>
  55. </div><!-- .entry-content -->
  56. <?php endif; ?>
  57. <footer class="entry-meta">
  58. <?php $show_sep = false; ?>
  59. <?php
  60. /* translators: used between list items, there is a space after the comma */
  61. $categories_list = get_the_category_list( __( ', ', 'catchbox' ) );
  62. if ( $categories_list ):
  63. ?>
  64. <span class="cat-links">
  65. <?php printf( __( '<span class="%1$s">Posted in</span> %2$s', 'catchbox' ), 'entry-utility-prep entry-utility-prep-cat-links', $categories_list );
  66. $show_sep = true; ?>
  67. </span>
  68. <?php endif; // End if categories ?>
  69. <?php
  70. /* translators: used between list items, there is a space after the comma */
  71. $tags_list = get_the_tag_list( '', __( ', ', 'catchbox' ) );
  72. if ( $tags_list ):
  73. if ( $show_sep ) : ?>
  74. <span class="sep"> | </span>
  75. <?php endif; // End if $show_sep ?>
  76. <span class="tag-links">
  77. <?php printf( __( '<span class="%1$s">Tagged</span> %2$s', 'catchbox' ), 'entry-utility-prep entry-utility-prep-tag-links', $tags_list );
  78. $show_sep = true; ?>
  79. </span>
  80. <?php endif; // End if $tags_list ?>
  81. <?php if ( comments_open() ) : ?>
  82. <?php if ( $show_sep ) : ?>
  83. <span class="sep"> | </span>
  84. <?php endif; // End if $show_sep ?>
  85. <span class="comments-link"><?php comments_popup_link( '<span class="leave-reply">' . __( 'Leave a reply', 'catchbox' ) . '</span>', __( '<b>1</b> Reply', 'catchbox' ), __( '<b>%</b> Replies', 'catchbox' ) ); ?></span>
  86. <?php endif; // End if comments_open() ?>
  87. <?php edit_post_link( __( 'Edit', 'catchbox' ), '<span class="edit-link">', '</span>' ); ?>
  88. </footer><!-- #entry-meta -->
  89. </article><!-- #post-<?php the_ID(); ?> -->