-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathattachment.php
150 lines (141 loc) · 9.35 KB
/
attachment.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
144
145
146
147
148
149
150
<?php
get_header();
$tech_sidebar = get_post_meta( $post->ID, "Sidebar_value", $single = true );
if ( empty( $tech_sidebar ) ) {
$tech_sidebar = "unset";
}
if ( (of_get_option( 'single_sidebar', '0' ) == "1" && $tech_sidebar == "unset") || $tech_sidebar == "on" ) {
tech_show_sidebar( "l" );
}
?>
<div id="content" class="<?php echo ( (of_get_option( 'single_sidebar', '0' ) == "1" && $tech_sidebar == "unset") || $tech_sidebar == "on" ) ? "narrow" : "wide"; ?>column">
<?php
if ( have_posts() ) {
while ( have_posts() ) {
the_post();
?>
<div <?php post_class(); ?> id="post-<?php the_ID(); ?>">
<h1 class="post_title"><a href="<?php echo get_permalink( $post->post_parent ); ?>" title="<?php esc_attr( printf( __( 'Return to %s', 'techozoic' ), get_the_title( $post->post_parent ) ) ); ?>" rel="gallery"><?php echo get_the_title( $post->post_parent ); ?></a> » <a href="<?php echo get_permalink() ?>" rel="bookmark" title="<?php printf( __( 'Permanent Link to %s', 'techozoic' ), get_the_title() ); ?>"><?php the_title(); ?></a></h1>
<div class="entry text">
<?php if ( wp_attachment_is_image() ) { ?>
<div id="main_image">
<a href="<?php echo wp_get_attachment_url( $post->ID ); ?>" title="<?php _e( 'View Full Size', 'techozoic' ); ?>">
<?php echo wp_get_attachment_image( $post->ID, array( $content_width, 9999 ) ); ?>
<span class="pic_info">
<?php
$metadata = wp_get_attachment_metadata();
$date_format = get_option( 'date_format' );
$camera = $metadata['image_meta'];
?>
<strong><?php _e( 'Image Information', 'techozoic' ); ?></strong>
<br />
<?php
printf( __( 'Size: %1$s × %2s', 'techozoic' ), $metadata['width'], $metadata['height'] );
echo " <br />";
if ( $camera['camera'] != "" ) {
printf( __( 'Camera: %s', 'techozoic' ), $camera['camera'] );
echo " <br />";
}
if ( $camera['created_timestamp'] != 0 ) {
printf( __( 'Taken: %s', 'techozoic' ), date( $date_format, $camera['created_timestamp'] ) );
echo " <br />";
}
if ( $camera['aperture'] != 0 ) {
printf( __( 'Aperture: %s', 'techozoic' ), $camera['aperture'] );
echo " <br />";
}
if ( $camera['iso'] != 0 ) {
printf( __( 'ISO: %s', 'techozoic' ), $camera['iso'] );
echo " <br />";
}
if ( $camera['shutter_speed'] != 0 ) {
printf( __( 'Shutter Speed: %s', 'techozoic' ), $camera['shutter_speed'] );
echo " <br />";
}
?>
<strong><?php _e( 'Click for original image', 'techozoic' ); ?></strong>
</span>
</a>
<br />
<div class="image_sizes">
<?php printf( __( 'Additional sizes: %s', 'techozoic' ), tech_image_links() ); ?>
</div>
</div><!--#main_image-->
<?php
}
the_content( '<p class="serif">' . __( 'Read the rest of this entry', 'techozoic' ) . '»</p>' );
if ( wp_attachment_is_image() ) {
$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' ) ) );
foreach ( $attachments as $k => $attachment ) {
if ( $attachment->ID == $post->ID )
break;
}
$k++;
// If there is more than 1 image attachment in a gallery
if ( count( $attachments ) > 1 ) {
if ( isset( $attachments[$k] ) ) {
$next_attachment_url = get_attachment_link( $attachments[$k]->ID );
$next_attachment_image = wp_get_attachment_image( $attachments[$k]->ID, array( 100, 9999 ) );
}
if ( isset( $attachments[$k - 2] ) ) {
$prev_attachment_url = get_attachment_link( $attachments[$k - 2]->ID );
$prev_attachment_image = wp_get_attachment_image( $attachments[$k - 2]->ID, array( 100, 9999 ) );
}
}
?>
<div id="pic-navigation" >
<?php
if ( isset( $prev_attachment_url ) ) {
echo '<div class="pic-previous"><a href="' . $prev_attachment_url . '" title="' . __( 'Previous Image', 'techozoic' ) . '">' . $prev_attachment_image . '</a></div>';
}
if ( isset( $next_attachment_url ) ) {
echo '<div class="pic-next"><a href="' . $next_attachment_url . '" title="' . __( 'Next Image', 'techozoic' ) . '">' . $next_attachment_image . '</a></div>';
}
?>
</div><!--#pic-navigation-->
<?php } else {
?>
<a href="<?php echo wp_get_attachment_url(); ?>" title="<?php echo esc_attr( get_the_title() ); ?>" rel="attachment"><?php echo basename( get_permalink() ); ?></a>
<?php
}
wp_link_pages( '<p><strong>' . __( 'Pages', 'techozoic' ) . ':</strong>', '</p>', 'number' );
?>
<div style="clear:both;margin-bottom:10px"></div>
<p class="postmetadata alt">
<small>
<?php
printf( __( 'This entry was posted on %1$s at %2$s and is filed under %3$s. You can follow any responses to this entry through the %4$s feed.', 'techozoic' ), get_the_time( $date_format ), get_the_time(), get_the_category_list( ', ' ), "<a href=\"" . get_post_comments_feed_link() . "\">" . __( 'RSS 2.0', 'techozoic' ) . "</a>" );
if ( ('open' == $post->comment_status) && ('open' == $post->ping_status) ) {
// Both Comments and Pings are open
printf( __( 'You can %1$s or %2$s from your own site.', 'techozoic' ), '<a href="#respond">' . __( 'leave a response', 'techozoic' ) . '</a>', '<a href="' . get_trackback_url() . '" rel="trackback">' . __( 'trackback', 'techozoic' ) . '</a>' );
} elseif ( !('open' == $post->comment_status) && ('open' == $post->ping_status) ) {
// Only Pings are Open
printf( __( 'Responses are currently closed, but you can %s from your site.', 'techozoic' ), '<a href="' . get_trackback_url() . '" rel="trackback">' . __( 'trackback', 'techozoic' ) . '</a>' );
} elseif ( ('open' == $post->comment_status) && !('open' == $post->ping_status) ) {
// Comments are open, Pings are not
_e( 'You can skip to the end and leave a response. Pinging is currently not allowed.', 'techozoic' );
} elseif ( !('open' == $post->comment_status) && !('open' == $post->ping_status) ) {
// Neither Comments, nor Pings are open
_e( 'Both comments and pings are currently closed.', 'techozoic' );
}
edit_post_link( ' ' . __( ' Edit this entry.', 'techozoic' ), '', '' );
?>
</small>
</p>
</div><!--.entrytext-->
</div><!--#post-???-->
<?php
} //Endwhile
} else {
?>
<p><?php _e( 'Sorry, no attachments matched your criteria.', 'techozoic' ) ?></p>
<?php
}//End if
?>
</div><!--#content-->
<?php
if ( (of_get_option( 'single_sidebar', '0' ) == "1" && $tech_sidebar == "unset") || $tech_sidebar == "on" ) {
tech_show_sidebar( "r" );
}
get_footer();
?>