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

/wp-content/themes/ifeature/image.php

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