[ Index ] |
WordPress Cross Reference |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * The template for displaying image attachments 4 * 5 * @link http://codex.wordpress.org/Template_Hierarchy 6 * 7 * @package WordPress 8 * @subpackage Twenty_Twelve 9 * @since Twenty Twelve 1.0 10 */ 11 12 get_header(); ?> 13 14 <div id="primary" class="site-content"> 15 <div id="content" role="main"> 16 17 <?php while ( have_posts() ) : the_post(); ?> 18 19 <article id="post-<?php the_ID(); ?>" <?php post_class( 'image-attachment' ); ?>> 20 <header class="entry-header"> 21 <h1 class="entry-title"><?php the_title(); ?></h1> 22 23 <footer class="entry-meta"> 24 <?php 25 $metadata = wp_get_attachment_metadata(); 26 printf( __( '<span class="meta-prep meta-prep-entry-date">Published </span> <span class="entry-date"><time class="entry-date" datetime="%1$s">%2$s</time></span> at <a href="%3$s" title="Link to full-size image">%4$s × %5$s</a> in <a href="%6$s" title="Return to %7$s" rel="gallery">%8$s</a>.', 'twentytwelve' ), 27 esc_attr( get_the_date( 'c' ) ), 28 esc_html( get_the_date() ), 29 esc_url( wp_get_attachment_url() ), 30 $metadata['width'], 31 $metadata['height'], 32 esc_url( get_permalink( $post->post_parent ) ), 33 esc_attr( strip_tags( get_the_title( $post->post_parent ) ) ), 34 get_the_title( $post->post_parent ) 35 ); 36 ?> 37 <?php edit_post_link( __( 'Edit', 'twentytwelve' ), '<span class="edit-link">', '</span>' ); ?> 38 </footer><!-- .entry-meta --> 39 40 <nav id="image-navigation" class="navigation" role="navigation"> 41 <span class="previous-image"><?php previous_image_link( false, __( '← Previous', 'twentytwelve' ) ); ?></span> 42 <span class="next-image"><?php next_image_link( false, __( 'Next →', 'twentytwelve' ) ); ?></span> 43 </nav><!-- #image-navigation --> 44 </header><!-- .entry-header --> 45 46 <div class="entry-content"> 47 48 <div class="entry-attachment"> 49 <div class="attachment"> 50 <?php 51 /* 52 * 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, 53 * 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 54 */ 55 $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' ) ) ); 56 foreach ( $attachments as $k => $attachment ) : 57 if ( $attachment->ID == $post->ID ) 58 break; 59 endforeach; 60 61 $k++; 62 // If there is more than 1 attachment in a gallery 63 if ( count( $attachments ) > 1 ) : 64 if ( isset( $attachments[ $k ] ) ) : 65 // get the URL of the next image attachment 66 $next_attachment_url = get_attachment_link( $attachments[ $k ]->ID ); 67 else : 68 // or get the URL of the first image attachment 69 $next_attachment_url = get_attachment_link( $attachments[ 0 ]->ID ); 70 endif; 71 else : 72 // or, if there's only 1 image, get the URL of the image 73 $next_attachment_url = wp_get_attachment_url(); 74 endif; 75 ?> 76 <a href="<?php echo esc_url( $next_attachment_url ); ?>" title="<?php the_title_attribute(); ?>" rel="attachment"><?php 77 /** 78 * Filter the image attachment size to use. 79 * 80 * @since Twenty Twelve 1.0 81 * 82 * @param array $size { 83 * @type int The attachment height in pixels. 84 * @type int The attachment width in pixels. 85 * } 86 */ 87 $attachment_size = apply_filters( 'twentytwelve_attachment_size', array( 960, 960 ) ); 88 echo wp_get_attachment_image( $post->ID, $attachment_size ); 89 ?></a> 90 91 <?php if ( ! empty( $post->post_excerpt ) ) : ?> 92 <div class="entry-caption"> 93 <?php the_excerpt(); ?> 94 </div> 95 <?php endif; ?> 96 </div><!-- .attachment --> 97 98 </div><!-- .entry-attachment --> 99 100 <div class="entry-description"> 101 <?php the_content(); ?> 102 <?php wp_link_pages( array( 'before' => '<div class="page-links">' . __( 'Pages:', 'twentytwelve' ), 'after' => '</div>' ) ); ?> 103 </div><!-- .entry-description --> 104 105 </div><!-- .entry-content --> 106 107 </article><!-- #post --> 108 109 <?php comments_template(); ?> 110 111 <?php endwhile; // end of the loop. ?> 112 113 </div><!-- #content --> 114 </div><!-- #primary --> 115 116 <?php get_footer(); ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Tue Mar 25 01:41:18 2014 | WordPress honlapkészítés: online1.hu |