Home › Forums › General Issues › Get Gallery Field no view images from another post › Reply To: Get Gallery Field no view images from another post
Hi @donnafefe
The gallery shortcode should be able to show images even if they’re not connected to the post if you pass along image ids.
However are you aware that you need to set the second parameter of get_field
to the other posts ID if you want to fetch them from another post?
<?php if ( get_field('imggal', $other_post_id) ) { ?>
<div class="galleria">
<?php
$image_ids = get_field('imggal', $other_post_id, false);
$shortcode = '[gallery limit="3" columns="3" order="ASC" orderby="menu_order ID" ids="' . implode(',', $image_ids) . '"]';
echo do_shortcode( $shortcode );
?>
</div>
<?php } ?>
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.