Advertisement
STATEDLIGHT

Image Attachment Template

Jan 21st, 2013
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.08 KB | None | 0 0
  1. <?php
  2. get_header(); ?>
  3.  
  4. <div id="content">
  5. <?php while ( have_posts() ) : the_post(); ?>
  6. <nav id="nav-single"> <span class="nav-previous">
  7. <?php previous_image_link( false, __( '&larr; Previous' , 'tiger' ) ); ?>
  8. </span> <span class="nav-next">
  9. <?php next_image_link( false, __( 'Next &rarr;' , 'tiger' ) ); ?>
  10. </span> </nav>
  11. <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
  12. <header class="entry-header">
  13. <h1 class="entry-title">
  14. <?php the_title(); ?>
  15. </h1>
  16. <div class="entry-meta">
  17. <?php $metadata = wp_get_attachment_metadata();
  18. printf( __( '<span class="meta-prep meta-prep-entry-date">Published </span> <span class="entry-date"><abbr class="published" title="%1$s">%2$s</abbr></span> at <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">%8$s</a>', 'tiger' ),
  19. esc_attr( get_the_time() ),
  20. get_the_date(),
  21. esc_url( wp_get_attachment_url() ),
  22. $metadata['width'],
  23. $metadata['height'],
  24. esc_url( get_permalink( $post->post_parent ) ),
  25. esc_attr( strip_tags( get_the_title( $post->post_parent ) ) ),
  26. get_the_title( $post->post_parent )
  27. );
  28. ?>
  29. <?php edit_post_link( __( 'Edit', 'tiger' ), '<span class="edit-link">', '</span>' ); ?>
  30. </div>
  31. </header>
  32. <div class="entry-content">
  33. <div class="entry-attachment">
  34. <div class="attachment">
  35. <?php
  36. $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' ) ) );
  37. foreach ( $attachments as $k => $attachment ) {
  38. if ( $attachment->ID == $post->ID )
  39. break;
  40. }
  41. $k++;
  42. if ( count( $attachments ) > 1 ) {
  43. if ( isset( $attachments[ $k ] ) )
  44. $next_attachment_url = get_attachment_link( $attachments[ $k ]->ID );
  45. else
  46. $next_attachment_url = get_attachment_link( $attachments[ 0 ]->ID );
  47. } else {
  48. $next_attachment_url = wp_get_attachment_url();
  49. }
  50. ?>
  51. <a href="<?php echo esc_url( $next_attachment_url ); ?>" title="<?php the_title_attribute(); ?>" rel="attachment">
  52. <?php
  53. $attachment_size = apply_filters( 'tiger_attachment_size', 640 );
  54. echo wp_get_attachment_image( $post->ID, array( $attachment_size, 1024 ) );
  55. ?>
  56. </a>
  57. <?php if ( ! empty( $post->post_excerpt ) ) : ?>
  58. <div class="entry-caption">
  59. <?php the_content(); ?>
  60. </div>
  61. <?php endif; ?>
  62. </div>
  63. </div>
  64. <div class="entry-description">
  65. <?php the_content(); ?>
  66. <?php wp_link_pages( array( 'before' => '<div class="page-link"><span>' . __( 'Pages:', 'tiger' ) . '</span>', 'after' => '</div>' ) ); ?>
  67. </div>
  68. </div>
  69. </article>
  70. <?php comments_template(); ?>
  71. <?php endwhile; ?>
  72. </div>
  73. <div id="sidebar">
  74. <?php dynamic_sidebar('right'); ?>
  75. </div>
  76. <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement