forked from rtCamp/rtpanel
-
Notifications
You must be signed in to change notification settings - Fork 0
/
image.php
executable file
·97 lines (75 loc) · 4.38 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
<?php
/**
* The template for displaying Image Attachments
*
* @package rtPanel
*
* @since rtPanel 2.1
*/
get_header(); ?>
<?php global $rtp_post_comments; ?>
<section id="content" class="rtp-image-attachment rtp-grid-12">
<?php rtp_hook_begin_content(); ?>
<?php
while( have_posts() ) {
the_post();
if ( $post->post_parent ) { ?>
<div class="rtp-navigation clearfix">
<div class="alignleft"><a role="link" href="<?php echo get_permalink( $post->post_parent ); ?>">← <?php echo get_the_title( $post->post_parent ); ?></a></div>
</div><?php
} ?>
<article <?php post_class( 'rtp-image-box' ); ?>>
<?php rtp_hook_begin_post(); ?>
<header class="post-header clearfix">
<?php rtp_hook_begin_post_title(); ?>
<h1 class="post-title<?php echo $rtp_post_comments['attachment_comments'] ? '' : ' rtp-has-comments' ?>"><?php the_title(); ?></h1>
<?php rtp_hook_end_post_title(); ?>
<?php rtp_hook_post_meta( 'top' ); ?>
</header><!-- .post-title -->
<div class="post-content clearfix">
<?php rtp_hook_begin_post_content(); ?>
<?php $img_info = wp_get_attachment_image_src( '', 'full' ); ?>
<figure role="img" class="wp-caption aligncenter" aria-describedby="figcaption_attachment_<?php echo get_the_ID(); ?>"<?php echo ( $img_info[1] < $max_content_width ) ? ' style="width: ' . ((int) $img_info[1]) . 'px";' : ''; ?>>
<a role="link" href="<?php echo $img_info[0]; ?>" title="<?php the_title_attribute(); ?>" rel="attachment"><?php echo wp_get_attachment_image( '', 'full' ); ?></a><?php
echo ( get_the_excerpt() ) ? '<figcaption id="figcaption_attachment_' . get_the_ID() . '" class="wp-caption-text">' . get_the_excerpt() . '</figcaption>' : ''; ?>
</figure>
<?php the_content(); ?>
<?php
if ( $post->post_parent > 0 ) {
$args = array(
'numberposts' => apply_filters( 'rtp_image_sibling_count', 10 ),
'order' => 'ASC',
'post_mime_type'=> 'image',
'post_parent' => $post->post_parent,
'post_status' => 'inherit',
'post_type' => 'attachment'
);
$attachments = get_children( $args );
if ( $attachments ) { ?>
<ul role="list" class="rtp-sibling-attachments rtp-container-12 rtp-alpha rtp-omega clearfix"><?php
$count = 1;
foreach( $attachments as $attachment ) {
if ( get_the_ID() != $attachment->ID ) {
$alpha_omega = NULL;
if ( $count % 6 == 1 ) {
$alpha_omega = ' rtp-alpha';
} elseif ( $count %6 == 0 ) {
$alpha_omega = ' rtp-omega';
}
echo '<li role="listitem" class="rtp-grid-2' . $alpha_omega . '">' . wp_get_attachment_link( $attachment->ID, 'thumbnail', true ) . '</li>';
$count++;
}
} ?>
</ul><?php
}
} ?>
<?php rtp_hook_end_post_content(); ?>
</div><!-- .post-content -->
<?php rtp_hook_post_meta( 'bottom' ); ?>
<?php rtp_hook_end_post(); ?>
</article><!-- .rtp-post-box --><?php
rtp_hook_comments();
} ?>
<?php rtp_hook_end_content(); ?>
</section><!-- #content -->
<?php get_footer(); ?>