-
Notifications
You must be signed in to change notification settings - Fork 7
/
image.php
executable file
·143 lines (110 loc) · 4.26 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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
<?php
/**
* The template used to display image type attachments.
*
* @package WordPress
* @subpackage K2
* @since K2 unknown
*/
$k2_image_link = false;
function k2_gallery_link($output) {
global $k2_image_link;
switch ($k2_image_link) {
case 'prev':
$output = str_replace('</a>', '<span>' . __('« Previous', 'k2') . '</span></a>', $output);
break;
case 'next':
$output = str_replace('</a>', '<span>' . __('Next »', 'k2') . '</span></a>', $output);
break;
}
return $output;
}
add_filter('wp_get_attachment_link', 'k2_gallery_link');
?>
<?php get_header(); ?>
<div class="wrapper template-image">
<?php if ( is_active_sidebar('widgets-top') ) : ?>
<div id="widgets-top" class="widgets">
<?php dynamic_sidebar('widgets-top'); ?>
</div>
<?php endif; ?>
<div class="primary">
<a name="startcontent"></a>
<?php /* K2 Hook */ do_action('template_primary_begin'); ?>
<?php if ( have_posts() ): while ( have_posts() ): the_post(); ?>
<?php if ( ! empty($post->post_parent) ): ?>
<div class="navigation">
<div class="nav-previous"><a href="<?php echo get_permalink($post->post_parent); ?>" rev="attachment"><span>«</span> <?php echo get_the_title($post->post_parent); ?></a></div>
<div class="clear"></div>
</div>
<?php endif; ?>
<div class="content hfeed">
<div id="entry-<?php the_ID(); ?>" <?php post_class(); ?>>
<div class="entry-header">
<h1 class="entry-title">
<a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php k2_permalink_title(); ?>"><?php the_title(); ?></a>
</h1>
<?php /* Edit Link */ edit_post_link( __('Edit', 'k2'), '<span class="entry-edit">', '</span>' ); ?>
<?php /* K2 Hook */ do_action('template_entry_head'); ?>
</div> <!-- .entry-header -->
<div class="entry-content">
<div class="attachment-image">
<a href="<?php echo wp_get_attachment_url($post->ID); ?>" class="image-link"><?php echo wp_get_attachment_image( $post->ID, 'medium' ); ?></a>
<?php if ( !empty($post->post_excerpt) ): ?>
<div class="caption"><?php the_excerpt(); ?></div>
<?php endif; ?>
</div>
</div> <!-- .entry-content -->
<div class="entry-footer">
<ul class="image-meta">
<li class="dimensions">
<span><?php _e('Dimensions:', 'k2'); ?></span>
<?php
list($width, $height) = getimagesize( get_attached_file($post->ID) );
/* translators: 1: image width, 2: image height */
printf( __('%1$s × %2$s pixels', 'k2'), $width, $height );
?>
</li>
<li class="file-size">
<span><?php _e('File Size:', 'k2'); ?></span>
<?php echo size_format( filesize( get_attached_file($post->ID) ) ); ?>
</li>
<li class="uploaded">
<span><?php _e('Uploaded on:', 'k2'); ?></span>
<?php echo k2_entry_date(); ?>
</li>
<?php /* K2 Hook */ do_action('k2_image_meta', $post->ID); ?>
</ul>
<div id="gallery-nav" class="navigation">
<div class="nav-previous">
<?php $k2_image_link = 'prev'; previous_image_link(); $k2_image_link = false; ?>
</div>
<div class="nav-next">
<?php $k2_image_link = 'next'; next_image_link(); $k2_image_link = false; ?>
</div>
<div class="clear"></div>
</div>
</div><!-- .entry-footer -->
</div> <!-- #entry-ID -->
<div class="comments">
<?php comments_template(); ?>
</div> <!-- .comments -->
<?php if ( ! empty($post->post_parent) ): ?>
<div class="navigation">
<div class="nav-previous"><a href="<?php echo get_permalink($post->post_parent); ?>" rev="attachment"><span>«</span> <?php echo get_the_title($post->post_parent); ?></a></div>
<div class="clear"></div>
</div>
<?php endif; ?>
<?php endwhile; else: define('K2_NOT_FOUND', true); ?>
<?php locate_template( array('blocks/k2-404.php'), true ); ?>
<?php endif; ?>
</div> <!-- .content -->
</div> <!-- .primary -->
<?php if ( ! get_post_custom_values('sidebarless') ) get_sidebar(); ?>
<?php if ( is_active_sidebar('widgets-bottom') ) : ?>
<div id="widgets-bottom" class="widgets">
<?php dynamic_sidebar('widgets-bottom'); ?>
</div>
<?php endif; ?>
</div> <!-- .wrapper -->
<?php get_footer(); ?>