Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php if(have_rows( 'image_gallery' ) ): ?>
- <?php while(have_rows( 'image_gallery' ) ): the_row();
- $gallery_name = get_sub_field('gallery_name');
- $category_name = get_sub_field('category_name');
- $gallery = get_sub_field('image_gallery');
- $value = get_row_index();
- ?>
- <div class="gallery" id="selector<?php echo $value; ?>">
- <img src="<?php echo $gallery[0]['url']; ?>" alt="" class="gallery-photo">
- <div class="gallery-info">
- <a href="#" class="linkgallery"><?php echo $gallery_name; ?></a>
- </div>
- <div class="gallery-info gallery-category">
- <?php echo $category_name; ?>
- </div>
- </div>
- <?php endwhile; ?>
- <?php endif; ?>
- $('#selector').on('click', function() {
- $(this).lightGallery({
- dynamic: true,
- dynamicEl: [{
- "src": '../static/img/1.jpg',
- 'thumb': '../static/img/thumb-1.jpg',
- 'subHtml': '<h4>Fading Light</h4><p>Classic view from Rigwood Jetty on Coniston Water an old archive shot similar to an old post but a little later on.</p>'
- }, {
- 'src': '../static/img/2.jpg',
- 'thumb': '../static/img/thumb-2.jpg',
- 'subHtml': "<h4>Bowness Bay</h4><p>A beautiful Sunrise this morning taken En-route to Keswick not one as planned but I'm extremely happy I was passing the right place at the right time....</p>"
- }, {
- 'src': '../static/img/3.jpg',
- 'thumb': '../static/img/thumb-3.jpg',
- 'subHtml': "<h4>Coniston Calmness</h4><p>Beautiful morning</p>"
- }]
- })
- });
- var arrayFromPhp = <?php echo json_encode($gallery); ?>;
- var myArr = [];
- jQuery.each(arrayFromPhp, function(index, item) {
- myArr.push({"src": item.url, 'thumb': item.url});
- console.log(item.ID);
- });
- $(this).lightGallery({
- dynamic: true,
- dynamicEl: myArr
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement