Created
February 26, 2015 20:30
-
-
Save wilhelser/62cbcf451ca0a6ee2561 to your computer and use it in GitHub Desktop.
Dakotas Gallery
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* Template Name: Gallery */ | |
get_header(); ?> | |
<main role="main"> | |
<section class="hero gallery-hero"> | |
<div class="menus-headline"> | |
<h1>Gallery</h1> | |
</div> | |
</section> | |
<section class="gallery-container"> | |
<div class="row"> | |
<div class="col-md-12"> | |
<?php if (have_posts()): ?> | |
<?php while (have_posts()) : the_post(); ?> | |
<?php if( get_post_gallery() ) : ?> | |
<?php | |
$gallery = get_post_gallery( get_the_ID(), false ); | |
$ids = explode(',', $gallery['ids']); | |
?> | |
<div id="gallery-masonry"> | |
<?php | |
foreach ($ids as $id) { | |
?> | |
<div class="item"> | |
<?php echo wp_get_attachment_image( $id, 'full' ); ?> | |
<a class="fancybox" rel="gallery" href="<?php echo wp_get_attachment_image_src( $id, 'full' )[0]; ?>" title="<?php echo get_the_title($id); ?>" > | |
<div class="item-description"> | |
<div class="item-title"> | |
<p>View</p> | |
</div> | |
</div> | |
</a> | |
</div> | |
<?php | |
} | |
?> | |
</div> | |
<?php else : ?> | |
You need to add a gallery to this section. | |
<?php endif; ?> | |
<?php endwhile; ?> | |
<?php endif; ?> | |
</div> | |
</div> | |
</section> | |
</main> | |
<?php get_footer(); ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment