-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathimage.php
96 lines (74 loc) · 1.89 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
88
89
90
91
92
93
94
95
96
<?php
/**
* Image Attachment Template
*
* This file displays Image attachments on their own page with a link back to
* the parent blog post/ page.
*
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/
*
* @package Granule
* @subpackage Template
* @author Ben Gillbanks <[email protected]>
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU Public License
*/
get_header();
if ( have_posts() ) {
?>
<main id="main" class="main-content content-single">
<?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>' );
get_template_part( 'parts/entry-meta' );
?>
</header>
<section class="entry">
<div class="attachment-image">
<?php echo wp_get_attachment_link( get_the_ID(), 'granule-attachment' ); ?>
</div>
<div class="attachment-description entry-single">
<?php
if ( has_excerpt() ) {
?>
<div class="attachment-caption">
<?php the_excerpt(); ?>
</div>
<?php
}
the_content();
?>
</div>
<?php
if ( $post->post_parent ) {
?>
<nav id="image-navigation" class="navigation image-navigation">
<div class="nav-links">
<span class="nav-parent">
<a href="<?php echo esc_url( get_permalink( $post->post_parent ) ); ?>" rev="attachment" class="attachment-parent"><?php esc_html_e( '‹ Return to post', 'granule' ); ?></a>
</span>
<span class="nav-previous">
<?php previous_image_link( false, esc_html__( 'Previous Image', 'granule' ) ); ?>
</span>
<span class="nav-next">
<?php next_image_link( false, esc_html__( 'Next Image', 'granule' ) ); ?>
</span>
</div>
</nav>
<?php
}
?>
</section>
</article>
<?php
get_template_part( 'parts/comments' );
}
?>
</main>
<?php
}
get_footer();