Home › Forums › Front-end Issues › Issues with Basic Gallery › Reply To: Issues with Basic Gallery
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!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.