This repository has been archived by the owner on Jan 28, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 16
/
image.php
87 lines (76 loc) · 2.43 KB
/
image.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
<?php
/**
* The template for displaying image attachments.
*
* @package FlyMag
*/
get_header(); ?>
<div id="primary" class="content-area">
<div id="content" class="site-content" role="main">
<?php while ( have_posts() ) : the_post(); ?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<header class="entry-header">
<?php the_title( '<h1 class="entry-title">', '</h1>' ); ?>
<div class="entry-meta">
<?php flymag_posted_on(); ?>
<span class="image-parent">
<?php
$metadata = wp_get_attachment_metadata();
printf(
/* translators: %1$s is post url, %2$s is post title */
__( '<i class="fa fa-pencil"></i> Image posted in: <a href="%1$s" title="Return to %2$s" rel="gallery">%2$s</a>', 'flymag' ),
get_permalink( $post->post_parent ),
get_the_title( $post->post_parent )
);
?>
</span>
</div>
</header>
<div class="entry-content">
<div class="entry-thumb">
<div class="entry-attachment">
<?php echo wp_get_attachment_image( $post->ID, 'entry-thumb' ); ?>
</div>
<?php if ( has_excerpt() ) : ?>
<div class="entry-caption">
<?php the_excerpt(); ?>
</div>
<?php endif; ?>
</div>
<?php the_content(); ?>
<?php wp_link_pages(
array(
'before' => '<div class="page-links">' . __( 'Pages:', 'flymag' ),
'after' => '</div>',
)
); ?>
</div>
<div class="images-sizes">
<?php _e( 'Image available in:', 'flymag' ); ?>
<?php
$images = array();
$image_sizes = get_intermediate_image_sizes();
array_unshift( $image_sizes, 'full' );
foreach ( $image_sizes as $image_size ) {
$image = wp_get_attachment_image_src( get_the_ID(), $image_size );
$name = $image[1] . 'x' . $image[2];
$images[] = '<a href="' . $image[0] . '">' . $name . '</a>';
}
echo implode( ' / ', $images );
?>
</div>
<nav class="image-navigation">
<span class="previous-image"><?php previous_image_link( false, __( '← Previous', 'flymag' ) ); ?></span>
<span class="next-image"><?php next_image_link( false, __( 'Next →', 'flymag' ) ); ?></span>
</nav>
</article>
<?php
if ( comments_open() || get_comments_number() ) :
comments_template();
endif;
?>
<?php endwhile; // end of the loop. ?>
</div>
</div>
<?php get_sidebar(); ?>
<?php get_footer(); ?>