-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathsingle.php
47 lines (41 loc) · 1.21 KB
/
single.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
<?php
/**
* Single Gallery
*
* @package BE_Gallery
* @since 1.0.0
* @link https://github.com/billerickson/BE-Gallery
* @author Bill Erickson <[email protected]>
* @copyright Copyright (c) 2011, Bill Erickson
* @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
*
*/
/**
* Single Gallery Content
* @since 1.0.0
*/
function be_single_gallery_content() {
global $post;
$args = array(
'post_parent' => $post->ID,
'post_type' => 'attachment',
'post_mime_type' => 'image',
'post_status' => 'inherit',
'posts_per_page' => '-1',
'order' => 'ASC',
'orderby' => 'menu_order date',
);
$images = new WP_Query( $args );
if( !$images->have_posts() )
return;
echo '<div class="gallery-listing">';
while( $images->have_posts() ): $images->the_post(); global $post;
// Echo image url
$image = wp_get_attachment_image_src( $post->ID, 'be_thumbnail' );
$classes = 'gallery-item';
echo '<div class="' . $classes . '"><a href="' . get_permalink() . '"><img src="' . $image[0] . '" /></a></div>';
endwhile; wp_reset_query();
echo '</div><!-- .gallery-listing -->';
}
add_action( 'genesis_post_content', 'be_single_gallery_content', 20 );
genesis();