$featured_image = wp_get_attachment_image_src($gallery_images_ids[0], 'properties-gallery-normal'); $_gallery = array(); foreach ($gallery_images_ids as $id) { $image = wp_get_attachment_image_src($id, 'properties-gallery-normal'); $_gallery[] = $image; } $gallery->images = $_gallery; $gallery->featured_image = $featured_image; } } // Save galleries if there is a permanent cache installed wp_cache_set('galleries', $galleries, THEME_NAME); } return $galleries; } $galleries = get_galleries($galleries_to_display); ?> <?php get_header(); ?> <div class="entry-content"> <?php ob_start(); ?> <div class="grid grid-fluid-<?php echo $galleries_per_row; ?>
function get_galleries($gal_tree, &$galleries) { foreach($gal_tree['Children'] as $child) { get_galleries($child, $galleries); } if(count($gal_tree['Img']) > 0) array_push($galleries, $gal_tree); }