PageRenderTime 48ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 0ms

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

https://bitbucket.org/lgorence/quickpress
PHP | 86 lines | 66 code | 10 blank | 10 comment | 14 complexity | f93c271c3ffa27c270a805d923d1ab52 MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.1, AGPL-1.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 Toolbox
  8. * @since Toolbox 1.0
  9. */
  10. ?>
  11. <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
  12. <header class="entry-header">
  13. <h1 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'toolbox' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h1>
  14. <div class="entry-meta">
  15. <?php toolbox_posted_on(); ?>
  16. </div><!-- .entry-meta -->
  17. </header><!-- .entry-header -->
  18. <?php if ( is_search() ) : // Only display Excerpts for search pages ?>
  19. <div class="entry-summary">
  20. <?php the_excerpt(); ?>
  21. </div><!-- .entry-summary -->
  22. <?php else : ?>
  23. <div class="entry-content">
  24. <?php if ( post_password_required() ) : ?>
  25. <?php the_content( __( 'Continue reading <span class="meta-nav">&rarr;</span>', 'toolbox' ) ); ?>
  26. <?php else : ?>
  27. <?php
  28. $images = get_children( array( 'post_parent' => $post->ID, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'orderby' => 'menu_order', 'order' => 'ASC' ) );
  29. if ( $images ) :
  30. $total_images = count( $images );
  31. $image = array_shift( $images );
  32. $image_img_tag = wp_get_attachment_image( $image->ID, 'thumbnail' );
  33. ?>
  34. <figure class="gallery-thumb">
  35. <a href="<?php the_permalink(); ?>"><?php echo $image_img_tag; ?></a>
  36. </figure><!-- .gallery-thumb -->
  37. <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, 'toolbox' ),
  38. 'href="' . get_permalink() . '" title="' . sprintf( esc_attr__( 'Permalink to %s', 'toolbox' ), the_title_attribute( 'echo=0' ) ) . '" rel="bookmark"',
  39. number_format_i18n( $total_images )
  40. ); ?></em></p>
  41. <?php endif; ?>
  42. <?php the_excerpt(); ?>
  43. <?php endif; ?>
  44. <?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', 'toolbox' ), 'after' => '</div>' ) ); ?>
  45. </div><!-- .entry-content -->
  46. <?php endif; ?>
  47. <footer class="entry-meta">
  48. <?php if ( 'post' == get_post_type() ) : // Hide category and tag text for pages on Search ?>
  49. <?php
  50. /* translators: used between list items, there is a space after the comma */
  51. $categories_list = get_the_category_list( __( ', ', 'toolbox' ) );
  52. if ( $categories_list && toolbox_categorized_blog() ) :
  53. ?>
  54. <span class="cat-links">
  55. <?php printf( __( 'Posted in %1$s', 'toolbox' ), $categories_list ); ?>
  56. </span>
  57. <span class="sep"> | </span>
  58. <?php endif; // End if categories ?>
  59. <?php
  60. /* translators: used between list items, there is a space after the comma */
  61. $tags_list = get_the_tag_list( '', __( ', ', 'toolbox' ) );
  62. if ( $tags_list ) :
  63. ?>
  64. <span class="tag-links">
  65. <?php printf( __( 'Tagged %1$s', 'toolbox' ), $tags_list ); ?>
  66. </span>
  67. <span class="sep"> | </span>
  68. <?php endif; // End if $tags_list ?>
  69. <?php endif; // End if 'post' == get_post_type() ?>
  70. <?php if ( comments_open() || ( '0' != get_comments_number() && ! comments_open() ) ) : ?>
  71. <span class="comments-link"><?php comments_popup_link( __( 'Leave a comment', 'toolbox' ), __( '1 Comment', 'toolbox' ), __( '% Comments', 'toolbox' ) ); ?></span>
  72. <span class="sep"> | </span>
  73. <?php endif; ?>
  74. <?php edit_post_link( __( 'Edit', 'toolbox' ), '<span class="edit-link">', '</span>' ); ?>
  75. </footer><!-- #entry-meta -->
  76. </article><!-- #post-<?php the_ID(); ?> -->