PageRenderTime 127ms CodeModel.GetById 24ms RepoModel.GetById 11ms app.codeStats 0ms

/wp-content/themes/simple-catch/image.php

https://github.com/Bochet/festival_lgbt
PHP | 127 lines | 92 code | 19 blank | 16 comment | 23 complexity | c566d3314c9bdf7e807d15fcce6ac30f MD5 | raw file
Possible License(s): GPL-2.0, AGPL-1.0, LGPL-2.1
  1. <?php
  2. /**
  3. * The template for displaying image attachments.
  4. *
  5. * @package Catch Themes
  6. * @subpackage Simple_Catch
  7. * @since Simple Catch 1.0
  8. */
  9. ?>
  10. <?php get_header();
  11. //Getting Global setting and meta layout Settings
  12. global $simplecatch_options_settings;
  13. $options = $simplecatch_options_settings;
  14. $themeoption_layout = $options['sidebar_layout'];
  15. $parent = $post->post_parent;
  16. $layout = get_post_meta( $parent,'simplecatch-sidebarlayout', true );
  17. if( empty( $layout ) ) {
  18. $layout='default';
  19. }
  20. ?>
  21. <div id="main" class="layout-978">
  22. <?php
  23. if ( $layout == 'no-sidebar' || ( $layout=='default' && $themeoption_layout == 'no-sidebar') ) {
  24. echo '<div id="content" class="col8">';
  25. }
  26. elseif ( $layout == 'left-sidebar' || ( $layout=='default' && $themeoption_layout == 'left-sidebar') ) {
  27. get_sidebar();
  28. echo '<div id="content" class="col8">';
  29. }
  30. else {
  31. echo '<div id="content" class="col8 no-margin-left">';
  32. }
  33. ?>
  34. <?php while ( have_posts() ) : the_post(); ?>
  35. <div <?php post_class(); ?>>
  36. <h2 class="entry-title"><a href="<?php echo get_permalink( $post->post_parent ); ?>" title="<?php esc_attr( printf( 'Return to %s', get_the_title( $post->post_parent ) ) ); ?>"><?php printf( '%s', get_the_title( $post->post_parent ) ); ?></a>: <span class="img-title"><?php the_title(); ?></span></h2>
  37. <ul class="post-by">
  38. <li class="no-padding-left"><a href="<?php echo get_author_posts_url(get_the_author_meta( 'ID' )); ?>"
  39. title="<?php echo esc_attr( get_the_author_meta( 'display_name' ) ); ?>"><?php _e( 'By', 'simplecatch' ); ?>&nbsp;<?php the_author_meta( 'display_name' );?></a></li>
  40. <li><?php $simplecatch_date_format = get_option( 'date_format' ); the_time( $simplecatch_date_format ); ?></li>
  41. <li><?php comments_popup_link( __( 'No Comments', 'simplecatch' ), __( '1 Comment', 'simplecatch' ), __( '% Comments', 'simplecatch' ) ); ?></li>
  42. </ul>
  43. <div class="entry-content">
  44. <div class="entry-attachment">
  45. <div class="attachment">
  46. <?php
  47. /**
  48. * Grab the IDs of all the image attachments in a gallery so we can get the URL of the next adjacent image in a gallery,
  49. * or the first image (if we're looking at the last image in a gallery), or, in a gallery of one, just the link to that image file
  50. */
  51. $attachments = array_values( get_children( array( 'post_parent' => $post->post_parent, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order ID' ) ) );
  52. foreach ( $attachments as $k => $attachment ) {
  53. if ( $attachment->ID == $post->ID )
  54. break;
  55. }
  56. $k++;
  57. // If there is more than 1 attachment in a gallery
  58. if ( count( $attachments ) > 1 ) {
  59. if ( isset( $attachments[ $k ] ) )
  60. // get the URL of the next image attachment
  61. $next_attachment_url = get_attachment_link( $attachments[ $k ]->ID );
  62. else
  63. // or get the URL of the first image attachment
  64. $next_attachment_url = get_attachment_link( $attachments[ 0 ]->ID );
  65. } else {
  66. // or, if there's only 1 image, get the URL of the image
  67. $next_attachment_url = wp_get_attachment_url();
  68. }
  69. ?>
  70. <a href="<?php echo esc_url( $next_attachment_url ); ?>" title="<?php the_title_attribute(); ?>" rel="attachment"><?php
  71. $attachment_size = apply_filters( 'simplecatch_attachment_size', 642 );
  72. echo wp_get_attachment_image( $post->ID, array( $attachment_size, 1024 ) ); // filterable image width with 1024px limit for image height.
  73. ?></a>
  74. <?php if ( ! empty( $post->post_excerpt ) ) : ?>
  75. <div class="entry-caption">
  76. <?php the_excerpt(); ?>
  77. </div>
  78. <?php endif; ?>
  79. </div><!-- .attachment -->
  80. </div><!-- .entry-attachment -->
  81. <div class="entry-description">
  82. <?php the_content(); ?>
  83. <?php wp_link_pages(array(
  84. 'before' => '<div class="pagination">',
  85. 'after' => '</div>',
  86. 'link_before' => '<span>',
  87. 'link_after' => '</span>',
  88. 'pagelink' => '%',
  89. 'echo' => 1
  90. ) );?>
  91. </div><!-- .entry-description -->
  92. </div><!-- .entry-content -->
  93. <ul id="nav-image" class="default-wp-page">
  94. <li class="previous"><?php previous_image_link( false, __( 'Previous Image' , 'simplecatch' ) ); ?></li>
  95. <li class="next"><?php next_image_link( false, __( 'Next Image' , 'simplecatch' ) ); ?></li>
  96. </ul><!-- #nav-image -->
  97. </div><!-- .post -->
  98. <?php endwhile; ?>
  99. <div class="row-end"></div>
  100. <?php comments_template(); ?>
  101. </div><!-- #content -->
  102. <?php
  103. if ( $layout == 'right-sidebar' || ( $layout=='default' && $themeoption_layout == 'right-sidebar') ) {
  104. get_sidebar();
  105. }
  106. ?>
  107. </div><!-- #main -->
  108. <?php get_footer(); ?>