Last active
February 5, 2016 11:01
-
-
Save beovulf/a78d9b2e9410dc467a65 to your computer and use it in GitHub Desktop.
Slider loop
This file contains hidden or 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 | |
$page_ID = $post->ID; | |
$lightbox_id = 1; // important to set lightbox id outside the loop | |
$q = new WP_Query( array( 'post_type' => 'page', 'post_parent' => $page_ID, 'depth' => 1, 'posts_per_page' => -1 ) ); | |
if ( $q->have_posts() ) : while ( $q->have_posts() ) : $q->the_post(); | |
$slider_array = array(get_field('slider_1') , get_field('slider_2') , get_field('slider_3') , get_field('slider_4')); | |
?> | |
<?php foreach ($slider_array as $slide) :?> | |
<div class="col-xs-6 col-pages"> | |
<a href="<?php echo $slide['sizes']['large'] ?>" data-lightbox="<?php echo 'localisation_'.$lightbox_id ?>"> | |
<div class="page-img-miniature" style="background: url('<?php echo $slide['sizes']['medium'] ; ?>') no-repeat center; background-size:cover"></div> | |
</a> | |
</div> | |
<?php endforeach; $lightbox_id = $lightbox_id + 1?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment