Home Forums General Issues Thumbnail Gallery with Lightbox


Thumbnail Gallery with Lightbox

  • I’ve been working with ACF Pro on and off for a few years. My level of PHP is not great, but I continue to learn.

    Over time I’ve been able to create a list of thumbnails each linked to a Lightbox for the full sized images. I’ve also have created a slideshow for other sized images each linked to a Lightbox for the full sized images. The common element from these two examples is that I used the ACF Pro Gallery Feature from ONE post on each example.

    Now, I’m trying to create a list of thumbnails from a “series of posts” and I’m not finding a solution. I’ve created a CPT, each has a gallery and a separate image using ACF Pro. The separate image is to be displayed in the thumbnail list and will have its own slideshow from its own post using the ACF Pro Gallery. It’s not working and I can’t seem to find a solution from the support section mostly because I’m not a great PHP coder.

    Can anyone recommend a template/theme using this type of combination that already has the code written? Perhaps, point me in the right direction to write the code? I’ve been racking my brain trying to figure how to write this loop and the code has become a mess. I’m interested in hiring help if that what it takes.

    Your feedback is greatly appreciated.

  • Hi @thinkjon

    Here’s a simple example how to get the thumbnail images from the CPT posts:

    $posts = get_posts(array(
    	'posts_per_page'	=> -1,
    	'post_type'			=> 'custom_post_type_slug'
    if( $posts ): ?>
    	<?php foreach( $posts as $post ): 
    		setup_postdata( $post )
                <?php $image = get_field('thumbnail_field_name'); ?>
    			<img src="<?php echo $image['url']; ?>" alt="<?php echo $image['alt']; ?>" />
    	<?php endforeach; ?>
    	<?php wp_reset_postdata(); ?>
    <?php endif; ?>

    Where ‘custom_post_type_slug’ is the slug of your CPT and ‘thumbnail_field_name’ is the name of your image custom field. These pages should give you more idea about it: and

    If you want to learn PHP, I recommend you checking this site: If you don’t have the time to do it, I suggest you hire a developer to help you out with it, and I’d recommend looking for one on or

    Hope this helps 🙂

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.