-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpage-gallery.php
More file actions
72 lines (54 loc) · 1.75 KB
/
page-gallery.php
File metadata and controls
72 lines (54 loc) · 1.75 KB
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
<?php
/*
Template Name: Photo Gallery
*/
// Add specific CSS class by filter
add_filter('body_class','custom_classname');
function custom_classname($classes) {
$classes[] = 'gallery';
return $classes;
}
$bgImage = false;
get_header(); ?>
<?php roots_content_before(); ?>
<div id="content-wrapper">
<div id="content" class="<?php echo CONTAINER_CLASSES; ?>">
<?php roots_main_before(); ?>
<div id="main" class="<?php echo FULLWIDTH_CLASSES; ?>" role="main">
<?php roots_loop_before(); ?>
<?php /* Start loop */ ?>
<?php while (have_posts()) : the_post(); ?>
<?php roots_post_before(); ?>
<?php roots_post_inside_before(); ?>
<?php // Get photo gallery images
$gallery = get_field('gallery');
if ($gallery) { ?>
<div id="gallery">
<ul>
<?php
foreach ($gallery as $galleryitem) {
$image = wp_get_attachment_image_src($galleryitem['image'], 'thumbnail');
$large = wp_get_attachment_image_src($galleryitem['image'], 'background');
$caption = $galleryitem['caption'];
$credit = $galleryitem['credit'];
?>
<li><a href="<?php echo $large[0]; ?>">
<img src="<?php echo $image[0]; ?>" alt="<?php echo esc_attr(strip_tags($caption));?>" />
</a>
<div class="caption"><?php echo $caption; ?> <span class="credit"><?php echo $credit; ?></span></div>
</li>
<?php } ?>
</ul>
</div>
<?php } ?>
<?php // the_content(); ?>
<?php roots_post_inside_after(); ?>
<?php roots_post_after(); ?>
<?php endwhile; /* End loop */ ?>
<?php roots_loop_after(); ?>
</div><!-- /#main -->
<?php roots_main_after(); ?>
</div><!-- /#content -->
</div>
<?php roots_content_after(); ?>
<?php get_footer(); ?>