PageRenderTime 52ms CodeModel.GetById 23ms RepoModel.GetById 1ms app.codeStats 0ms

/content-gallery.php

https://github.com/lecar-red/3ring-wordpress
PHP | 68 lines | 51 code | 13 blank | 4 comment | 8 complexity | 29feb4d32c6349719014184c1e6fcb99 MD5 | raw file
Possible License(s): AGPL-1.0
  1. <?php
  2. /**
  3. * @package WordPress
  4. * @subpackage Yoko
  5. */
  6. ?>
  7. <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
  8. <div class="entry-post-format">
  9. <header class="entry-header">
  10. <h2 class="entry-title"><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'yoko' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a></h2>
  11. <p><?php echo get_the_date(); ?> <?php _e( 'by', 'yoko' ); ?> <?php the_author() ?>
  12. <?php if ( comments_open() ) : ?> | <?php comments_popup_link( __( '0 comments', 'yoko' ), __( '1 Comment', 'yoko' ), __( '% Comments', 'yoko' ) ); ?><?php endif; ?></p>
  13. </header><!-- end entry-header -->
  14. <?php if ( is_search() ) : // Only display Excerpts for search pages ?>
  15. <div class="entry-summary">
  16. <?php the_excerpt( __( 'View the pictures &rarr;', 'yoko' ) ); ?>
  17. </div><!-- end entry-summary -->
  18. <?php else : ?>
  19. <?php if ( post_password_required() ) : ?>
  20. <?php the_content( __( 'View the pictures &rarr;', 'yoko' ) ); ?>
  21. <?php else : ?>
  22. <?php
  23. $images = get_children( array( 'post_parent' => $post->ID, 'post_type' => 'attachment', 'post_mime_type' => 'image', 'orderby' => 'menu_order', 'order' => 'ASC', 'numberposts' => 999 ) );
  24. if ( $images ) :
  25. $total_images = count( $images );
  26. $image = array_shift( $images );
  27. $image_img_tag = wp_get_attachment_image( $image->ID, 'medium' );
  28. ?>
  29. <figure class="gallery-thumb">
  30. <a href="<?php the_permalink(); ?>"><?php echo $image_img_tag; ?></a>
  31. </figure><!-- end gallery-thumb -->
  32. <?php endif; ?>
  33. <div class="entry-post-format">
  34. <?php the_content( __( 'View the pictures &rarr;', 'yoko' ) ); ?>
  35. <?php endif; ?>
  36. <p class="pics-count"><?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, 'yoko' ),
  37. 'href="' . get_permalink() . '" title="' . sprintf( esc_attr__( 'Permalink to %s', 'yoko' ), the_title_attribute( 'echo=0' ) ) . '" rel="bookmark"',
  38. number_format_i18n( $total_images )
  39. ); ?></p>
  40. </div><!-- end entry-content-gallery -->
  41. <?php endif; ?>
  42. <?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', 'yoko' ), 'after' => '</div>' ) ); ?>
  43. <footer class="entry-meta">
  44. <p><?php if ( count( get_the_category() ) ) : ?>
  45. <?php printf( __( 'Categories: %2$s', 'yoko' ), 'entry-utility-prep entry-utility-prep-cat-links', get_the_category_list( ', ' ) ); ?> |
  46. <?php endif; ?>
  47. <?php $tags_list = get_the_tag_list( '', ', ' );
  48. if ( $tags_list ): ?>
  49. <?php printf( __( 'Tags: %2$s', 'yoko' ), 'entry-utility-prep entry-utility-prep-tag-links', $tags_list ); ?> |
  50. <?php endif; ?>
  51. <a href="<?php echo get_permalink(); ?>"><?php _e( 'Permalink ', 'yoko' ); ?></a>
  52. <?php edit_post_link( __( 'Edit &rarr;', 'yoko' ), '| <span class="edit-link">', '</span>' ); ?></p>
  53. </footer><!-- end entry-meta-->
  54. </div><!-- end entry-gallery -->
  55. </article><!-- end post-<?php the_ID(); ?> -->