PageRenderTime 44ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/wp-content/themes/twentyeleven/content-gallery.php

https://bitbucket.org/aqge/deptandashboard
PHP | 92 lines | 72 code | 9 blank | 11 comment | 10 complexity | 59d58eeb3ff74cf8806f98bf05dfd70b MD5 | raw file
Possible License(s): AGPL-1.0, GPL-2.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 WordPress
  8. * @subpackage Twenty_Eleven
  9. * @since Twenty Eleven 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', 'twentyeleven' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
  16. <h3 class="entry-format"><?php _e( 'Gallery', 'twentyeleven' ); ?></h3>
  17. </hgroup>
  18. <div class="entry-meta">
  19. <?php twentyeleven_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>', 'twentyeleven' ) ); ?>
  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, 'twentyeleven' ),
  42. 'href="' . esc_url( get_permalink() ) . '" title="' . sprintf( esc_attr__( 'Permalink to %s', 'twentyeleven' ), 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( 'before' => '<div class="page-link"><span>' . __( 'Pages:', 'twentyeleven' ) . '</span>', 'after' => '</div>' ) ); ?>
  49. </div><!-- .entry-content -->
  50. <?php endif; ?>
  51. <footer class="entry-meta">
  52. <?php $show_sep = false; ?>
  53. <?php
  54. /* translators: used between list items, there is a space after the comma */
  55. $categories_list = get_the_category_list( __( ', ', 'twentyeleven' ) );
  56. if ( $categories_list ):
  57. ?>
  58. <span class="cat-links">
  59. <?php printf( __( '<span class="%1$s">Posted in</span> %2$s', 'twentyeleven' ), 'entry-utility-prep entry-utility-prep-cat-links', $categories_list );
  60. $show_sep = true; ?>
  61. </span>
  62. <?php endif; // End if categories ?>
  63. <?php
  64. /* translators: used between list items, there is a space after the comma */
  65. $tags_list = get_the_tag_list( '', __( ', ', 'twentyeleven' ) );
  66. if ( $tags_list ):
  67. if ( $show_sep ) : ?>
  68. <span class="sep"> | </span>
  69. <?php endif; // End if $show_sep ?>
  70. <span class="tag-links">
  71. <?php printf( __( '<span class="%1$s">Tagged</span> %2$s', 'twentyeleven' ), 'entry-utility-prep entry-utility-prep-tag-links', $tags_list );
  72. $show_sep = true; ?>
  73. </span>
  74. <?php endif; // End if $tags_list ?>
  75. <?php if ( comments_open() ) : ?>
  76. <?php if ( $show_sep ) : ?>
  77. <span class="sep"> | </span>
  78. <?php endif; // End if $show_sep ?>
  79. <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>
  80. <?php endif; // End if comments_open() ?>
  81. <?php edit_post_link( __( 'Edit', 'twentyeleven' ), '<span class="edit-link">', '</span>' ); ?>
  82. </footer><!-- #entry-meta -->
  83. </article><!-- #post-<?php the_ID(); ?> -->