image.php 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. <?php
  2. /**
  3. * Title: Image template.
  4. *
  5. * Description: Defines template for single image page.
  6. *
  7. * Please do not edit this file. This file is part of the CyberChimps Framework and all modifications
  8. * should be made in a child theme.
  9. *
  10. * @category CyberChimps Framework
  11. * @package Framework
  12. * @since 1.0
  13. * @author CyberChimps
  14. * @license http://www.opensource.org/licenses/gpl-license.php GPL v3.0 (or later)
  15. * @link http://www.cyberchimps.com/
  16. */
  17. get_header(); ?>
  18. <div id="image_page" class="container-full-width">
  19. <div class="container">
  20. <div class="container-fluid">
  21. <?php do_action( 'cyberchimps_before_container' ); ?>
  22. <div id="container" <?php cyberchimps_filter_container_class(); ?>>
  23. <?php do_action( 'cyberchimps_before_content_container' ); ?>
  24. <div id="content" <?php cyberchimps_filter_content_class(); ?>>
  25. <?php do_action( 'cyberchimps_before_content' ); ?>
  26. <?php while ( have_posts() ) : the_post(); ?>
  27. <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
  28. <header class="entry-header">
  29. <h1 class="entry-title"><?php the_title(); ?></h1>
  30. <div class="entry-meta">
  31. <?php
  32. $metadata = wp_get_attachment_metadata();
  33. printf( __( 'Published', 'business-lite' ) . ' <span class="entry-date"><time class="entry-date" datetime="%1$s">%2$s</time></span> - ' . __( 'size', 'business-lite' ) . ': <a href="%3$s" title="Link to full-size image">%4$s &times; %5$s</a> ' . __( 'in', 'business-lite' ) . ' <a href="%6$s" title="Return to %7$s" rel="gallery">%7$s</a>',
  34. esc_attr( get_the_date( 'c' ) ),
  35. esc_html( get_the_date() ),
  36. wp_get_attachment_url(),
  37. $metadata['width'],
  38. $metadata['height'],
  39. get_permalink( $post->post_parent ),
  40. get_the_title( $post->post_parent )
  41. );
  42. ?>
  43. <?php edit_post_link( __( 'Edit', 'business-lite' ), '<span class="sep"> | </span> <span class="edit-link">', '</span>' ); ?>
  44. </div>
  45. <!-- .entry-meta -->
  46. <nav id="image-navigation" class="row-fluid">
  47. <div class="span6">
  48. <div class="previous-image"><?php previous_image_link( false, '&larr; ' . __( 'Previous', 'business-lite' ) ); ?></div>
  49. </div>
  50. <div class="span6">
  51. <div class="next-image alignright"><?php next_image_link( false, __( 'Next', 'business-lite' ) . ' &rarr;' ); ?></div>
  52. </div>
  53. </nav>
  54. <!-- #image-navigation -->
  55. </header>
  56. <!-- .entry-header -->
  57. <div class="entry-content">
  58. <div class="entry-attachment">
  59. <div class="attachment">
  60. <a href="<?php wp_get_attachment_link( $post->ID, 'fullsize' ); ?>" title="<?php echo esc_attr( get_the_title() ); ?>" rel="attachment"><?php
  61. $attachment_size = apply_filters( 'cyberchimps_attachment_size', array( 1200, 1200 ) ); // Filterable image size.
  62. echo wp_get_attachment_image( $post->ID, $attachment_size );
  63. ?></a>
  64. </div>
  65. <!-- .attachment -->
  66. <?php if ( !empty( $post->post_excerpt ) ) : ?>
  67. <div class="entry-caption">
  68. <?php the_excerpt(); ?>
  69. </div>
  70. <?php endif; ?>
  71. </div>
  72. <!-- .entry-attachment -->
  73. <?php the_content(); ?>
  74. <?php wp_link_pages( array( 'before' => '<div class="page-links">' . __( 'Pages:', 'business-lite' ), 'after' => '</div>' ) ); ?>
  75. </div>
  76. <!-- .entry-content -->
  77. <?php
  78. // HS Thumbnail next and previous image
  79. $attachments = array_values(
  80. get_children(
  81. array(
  82. 'post_parent' => $post->post_parent,
  83. 'post_status' => 'inherit',
  84. 'post_type' => 'attachment',
  85. 'post_mime_type' => 'image',
  86. 'order' => 'DESC',
  87. 'orderby' => 'menu_order ID'
  88. )
  89. )
  90. );
  91. foreach ( $attachments as $k => $attachment ) {
  92. if ( $attachment->ID == $post->ID ) {
  93. $previous_image = isset( $attachments[$k - 1] ) ? $attachments[$k - 1]->ID : false;
  94. $next_image = isset( $attachments[$k + 1] ) ? $attachments[$k + 1]->ID : false;
  95. $first_image = isset( $attachments[0] ) ? $attachments[0]->ID : false;
  96. $last_image = isset( $attachments[$k + 1] ) ? end( $attachments )->ID : false;
  97. $previous_url = isset( $attachments[$k - 1] ) ? get_permalink( $attachments[$k - 1]->ID ) : get_permalink( $attachments[0]->ID );
  98. $next_url = isset( $attachments[$k + 1] ) ? get_permalink( $attachments[$k + 1]->ID ) : get_permalink( $attachments[0]->ID );
  99. $first_url = isset( $attachments[0] ) ? get_permalink( $attachments[0] ) : false;
  100. $last_url = isset( $attachments[$k + 1] ) ? get_permalink( end( $attachments )->ID ) : get_permalink( $attachments[0]->ID );
  101. }
  102. }
  103. ?>
  104. <div class="row-fluid gallery-pagination">
  105. <div class="span6 previous-image">
  106. <?php if ( $previous_image == false && count( $attachments ) > 1 ): ?>
  107. <a href="<?php echo $last_url; ?>"><?php echo wp_get_attachment_image( $last_image, 'thumbnail' ); ?></a>
  108. <?php elseif ( $previous_image != $post->ID ): ?>
  109. <a href="<?php echo $previous_url; ?>"><?php echo wp_get_attachment_image( $previous_image, 'thumbnail' ); ?></a>
  110. <?php endif; ?>
  111. </div>
  112. <!-- span6 -->
  113. <div class="span6 next-image">
  114. <?php if ( $next_image == false && count( $attachments > 1 ) ): ?>
  115. <a href="<?php echo $first_url; ?>"><?php echo wp_get_attachment_image( $first_image, 'thumbnail' ); ?></a>
  116. <?php elseif ( $next_image != $post->ID ): ?>
  117. <a href="<?php echo $next_url; ?>"><?php echo wp_get_attachment_image( $next_image, 'thumbnail' ); ?></a>
  118. <?php endif; ?>
  119. </div>
  120. <!-- span6 -->
  121. </div>
  122. <!-- row fluid -->
  123. <?php // HS END Thumbnail next and previous image ?>
  124. <footer class="entry-meta">
  125. <?php if ( comments_open() && pings_open() ) : // Comments and trackbacks open ?>
  126. <?php printf( '<a class="comment-link" href="#respond" title="Post a comment">' . __( 'Post a comment', 'business-lite' ) . '</a> ' . __( 'or leave a trackback', 'business-lite' ) . ': <a class="trackback-link" href="%s" title="Trackback URL for your post" rel="trackback">' . __( 'Trackback URL', 'business-lite' ) . '</a>.', get_trackback_url() ); ?>
  127. <?php elseif ( !comments_open() && pings_open() ) : // Only trackbacks open ?>
  128. <?php printf( __( 'Comments are closed, but you can leave a trackback:', 'business-lite' ) . ' <a class="trackback-link" href="%s" title="Trackback URL for your post" rel="trackback">' . __( 'Trackback URL', 'business-lite' ) . '</a>.', get_trackback_url() ); ?>
  129. <?php
  130. elseif ( comments_open() && !pings_open() ) : // Only comments open
  131. ?>
  132. <?php _e( 'Trackbacks are closed, but you can', 'business-lite' ) . ' <a class="comment-link" href="#respond" title="Post a comment">' . __( 'post a comment', 'business-lite' ) . '</a>.'; ?>
  133. <?php
  134. elseif ( !comments_open() && !pings_open() ) : // Comments and trackbacks closed
  135. ?>
  136. <?php _e( 'Both comments and trackbacks are currently closed.', 'business-lite' ); ?>
  137. <?php endif; ?>
  138. <?php edit_post_link( __( 'Edit', 'business-lite' ), ' <span class="edit-link">', '</span>' ); ?>
  139. </footer>
  140. <!-- .entry-meta -->
  141. </article><!-- #post-<?php the_ID(); ?> -->
  142. <?php comments_template(); ?>
  143. <?php endwhile; // end of the loop. ?>
  144. <?php do_action( 'cyberchimps_after_content' ); ?>
  145. </div>
  146. <!-- #content -->
  147. <?php do_action( 'cyberchimps_after_content_container' ); ?>
  148. </div>
  149. <!-- #container .row-fluid-->
  150. <?php do_action( 'cyberchimps_after_container' ); ?>
  151. </div>
  152. <!--container fluid -->
  153. </div>
  154. <!-- container -->
  155. </div><!-- container full width -->
  156. <?php get_footer(); ?>