Thanks for the continued help, much appreciated!
I think I was able to get it working by altering the code to display the gallery in my template file. Instead of using:
echo do_shortcode('[gallery orderby="menu_order" link="none" size="large" columns="1"]')
I’m now using:
<?php if ( '' !== ( $gallery = get_post_meta( get_the_ID(), 'project_gallery', true ) ) ) : ?> <section class="project-gallery"> <?php echo do_shortcode( $gallery ); ?> </section> <?php endif; ?>
The ‘if’ statement was already wrapping my original code, I just wasn’t taking advantage of it properly. Someone else had started this plugin for us, and I was just trying to get it working (with my limited PHP knowledge).
It now functions just like a gallery added to the main content area, so we do have to make sure all variables are accounted for there (e.g, link=none, size=large, etc.). But this is fine.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
© 2022 Advanced Custom Fields.