| 1 | <?php |
|---|
| 2 | /** |
|---|
| 3 | * The template for displaying attachments. |
|---|
| 4 | * |
|---|
| 5 | * @package Fluida |
|---|
| 6 | */ |
|---|
| 7 | |
|---|
| 8 | get_header(); ?> |
|---|
| 9 | |
|---|
| 10 | <div id="container" class="single-attachment <?php echo fluida_get_layout_class(); ?>"> |
|---|
| 11 | <main id="main" role="main" class="main"> |
|---|
| 12 | |
|---|
| 13 | <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?> |
|---|
| 14 | |
|---|
| 15 | <article id="post-<?php the_ID(); ?>" <?php post_class("post"); cryout_schema_microdata('article');?>> |
|---|
| 16 | |
|---|
| 17 | <header> |
|---|
| 18 | <?php cryout_post_title_hook(); ?> |
|---|
| 19 | <h1 class="entry-title" <?php cryout_schema_microdata('entry-title'); ?>><?php the_title(); ?></h1> |
|---|
| 20 | <div class="entry-meta"> |
|---|
| 21 | <?php cryout_post_meta_hook(); |
|---|
| 22 | echo "<span class=\"attach-size\">"; |
|---|
| 23 | if ( wp_attachment_is_image() ) { |
|---|
| 24 | $metadata = wp_get_attachment_metadata(); |
|---|
| 25 | printf( __( 'Full size is %s pixels', 'fluida'), |
|---|
| 26 | sprintf( '<a href="%1$s" title="%2$s">%3$s × %4$s</a>', |
|---|
| 27 | wp_get_attachment_url(), |
|---|
| 28 | esc_attr( __('Link to full-size image', 'fluida') ), |
|---|
| 29 | $metadata['width'], |
|---|
| 30 | $metadata['height'] |
|---|
| 31 | ) |
|---|
| 32 | ); |
|---|
| 33 | } |
|---|
| 34 | echo "</span>"; ?> |
|---|
| 35 | </div><!-- .entry-meta --> |
|---|
| 36 | </header> |
|---|
| 37 | |
|---|
| 38 | <div class="entry-content" <?php cryout_schema_microdata('entry-content'); ?>> |
|---|
| 39 | <div class="entry-attachment"> |
|---|
| 40 | |
|---|
| 41 | <?php if ( wp_attachment_is_image() ) : |
|---|
| 42 | $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' ) ) ); |
|---|
| 43 | foreach ( $attachments as $k => $attachment ) { |
|---|
| 44 | if ( $attachment->ID == $post->ID ) |
|---|
| 45 | break; |
|---|
| 46 | } |
|---|
| 47 | $k++; |
|---|
| 48 | // If there is more than 1 image attachment in a gallery |
|---|
| 49 | if ( count( $attachments ) > 1 ) { |
|---|
| 50 | if ( isset( $attachments[ $k ] ) ) |
|---|
| 51 | // get the URL of the next image attachment |
|---|
| 52 | $next_attachment_url = get_attachment_link( $attachments[ $k ]->ID ); |
|---|
| 53 | else |
|---|
| 54 | // or get the URL of the first image attachment |
|---|
| 55 | $next_attachment_url = get_attachment_link( $attachments[ 0 ]->ID ); |
|---|
| 56 | } else { |
|---|
| 57 | // or, if there's only 1 image attachment, get the URL of the image |
|---|
| 58 | $next_attachment_url = wp_get_attachment_url(); |
|---|
| 59 | } |
|---|
| 60 | ?> |
|---|
| 61 | <p class="attachment"> |
|---|
| 62 | <a href="<?php echo $next_attachment_url; ?>" title="<?php echo esc_attr( get_the_title() ); ?>" rel="attachment"><?php |
|---|
| 63 | $attachment_size = apply_filters( 'fluida_attachment_size', 900 ); |
|---|
| 64 | echo wp_get_attachment_image( $post->ID, array( $attachment_size, 9999 ) ); // filterable image width with, essentially, no limit for image height.?> |
|---|
| 65 | </a> |
|---|
| 66 | </p> |
|---|
| 67 | |
|---|
| 68 | <footer class="entry-meta"> |
|---|
| 69 | <?php cryout_post_footer_hook(); ?> |
|---|
| 70 | <?php if ( ! empty( $post->post_parent ) ) : ?> |
|---|
| 71 | <p class="page-title"><a href="<?php echo get_permalink( $post->post_parent ); ?>" title="<?php esc_attr( printf( __( 'Return to %s', 'fluida' ), get_the_title( $post->post_parent ) ) ); ?>" ><?php |
|---|
| 72 | /* translators: %s - title of parent post */ |
|---|
| 73 | printf( '« %s', get_the_title( $post->post_parent ) ); |
|---|
| 74 | ?></a></p> |
|---|
| 75 | <?php endif; ?> |
|---|
| 76 | </footer><!-- .entry-meta --> |
|---|
| 77 | |
|---|
| 78 | <?php else : ?> |
|---|
| 79 | <a href="<?php echo wp_get_attachment_url(); ?>" title="<?php echo esc_attr( get_the_title() ); ?>" rel="attachment"><?php echo basename( get_permalink() ); ?></a> |
|---|
| 80 | <?php endif; ?> |
|---|
| 81 | </div><!-- .entry-attachment --> |
|---|
| 82 | |
|---|
| 83 | |
|---|
| 84 | <div class="entry-caption"> |
|---|
| 85 | <?php if ( !empty( $post->post_excerpt ) ) the_excerpt(); ?> |
|---|
| 86 | </div> |
|---|
| 87 | |
|---|
| 88 | |
|---|
| 89 | </div><!-- .entry-content --> |
|---|
| 90 | |
|---|
| 91 | <div id="nav-below" class="navigation"> |
|---|
| 92 | <div class="nav-previous"><?php previous_image_link( false,'<i class="icon-left-dir"></i>'.__("Previous image","fluida")); ?></div> |
|---|
| 93 | <div class="nav-next"><?php next_image_link( false,__("Next image","fluida").'<i class="icon-right-dir"></i>' ); ?></div> |
|---|
| 94 | </div><!-- #nav-below --> |
|---|
| 95 | |
|---|
| 96 | <?php comments_template( '', true ); ?> |
|---|
| 97 | |
|---|
| 98 | </article><!-- #post-## --> |
|---|
| 99 | |
|---|
| 100 | |
|---|
| 101 | <?php endwhile; ?> |
|---|
| 102 | |
|---|
| 103 | |
|---|
| 104 | |
|---|
| 105 | </main><!-- #main --> |
|---|
| 106 | <?php fluida_get_sidebar(); ?> |
|---|
| 107 | </div><!-- #container --> |
|---|
| 108 | |
|---|
| 109 | <?php get_footer(); ?> |
|---|