forked from AgriLife/AgriFlex
-
Notifications
You must be signed in to change notification settings - Fork 0
/
content-gallery.php
74 lines (67 loc) · 2.43 KB
/
content-gallery.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
<?php
/**
* Template for displaying galleries.
*
* In AgriFlex 1.0 the category 'gallery' was used. Since its creation
* post formats were introduced to WordPress. We have implemented post formats
* into 2.0 and have created a function to maintain backwards compatibility.
*
* @author J. Aaron Eaton <[email protected]>
* @package AgriFlex
* @since AgriFlex 2.0
*/
?>
<div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<h2 class="entry-title">
<a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'agriflex' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?></a>
</h2>
<div class="entry-meta">
<?php agriflex_posted_on(); ?>
</div><!-- .entry-meta -->
<div class="entry-content">
<?php if ( post_password_required() ) : ?>
<?php the_content(); ?>
<?php else : ?>
<div class="gallery-thumb">
<?php
$images = get_children( array(
'post_parent' => $post->ID,
'post_type' => 'attachment',
'post_mime_type' => 'image',
'orderby' => 'menu_order',
'order' => 'ASC',
'numberposts' => 999 )
);
$total_images = count( $images );
$image = array_shift( $images );
$image_img_tag = wp_get_attachment_image( $image->ID, 'thumbnail' );
?>
<a class="size-thumbnail" href="<?php the_permalink(); ?>">
<?php echo $image_img_tag; ?>
</a>
</div><!-- .gallery-thumb -->
<p>
<em>
<?php printf( __( 'This gallery contains <a %1$s>%2$s photos</a>.',
'agriflex' ),
'href="' . get_permalink() . '" title="' .
sprintf( esc_attr__( 'Permalink to %s', 'agriflex' ),
the_title_attribute( 'echo=0' ) ) . '" rel="bookmark"',
$total_images ); ?>
</em>
</p>
<?php the_excerpt(); ?>
<?php endif; ?>
</div><!-- .entry-content -->
<div class="entry-utility">
<a href="<?php echo get_term_link(
_x('gallery', 'gallery category slug', 'agriflex'), 'category' ); ?>"
title="<?php esc_attr_e( 'View posts in the Gallery category',
'agriflex' ); ?>">
<?php _e( 'More Galleries', 'agriflex' ); ?>
</a>
<span class="meta-sep">|</span>
<?php agriflex_comments_link(); ?>
<?php agriflex_edit_link(); ?>
</div><!-- .entry-utility -->
</div><!-- #post-<?php the_ID(); ?> -->