Have you tried passing $pid instead of using get_the_ID()
?
if (get_post_gallery($pid)) :
$gallery = get_post_gallery($pid, false);
endif;
Related Posts:
- Return only one post format in index.php [duplicate]
- Get gallery and product gallery images full size
- Change the way wordpress outputs images or image galleries
- Jquery Slider for profile template
- Split Content and Gallery
- AJAX with loop filtering categories
- How to get the first image gallery of a product in woocommerce in a loop
- Can I load posts via Ajax?
- pop-up lighbox with AJAX
- Ajax loop in sidebar to load post titles/categories
- Filtering posts by multiple taxonomies
- Ajax loop refresh on click
- Add Infinite Scroll to Ajax Loaded Category Query
- Load comments per post on click with AJAX
- Chopping up a large ajax request of around 200 posts [closed]
- How to get_template_part using AJAX?
- Category Ajax call
- Customize WooCommerce Product Images (Placement and size) [closed]
- Split loop to load WordPress gallery into Bootstrap modal and carousel
- How do I use AJAX Query in my posts loop?
- Ajax Button to load more Posts into a timeline
- show random image in loop if image is not set
- Shortcode in posts called by ajax is not working
- Distribute Gallery Images Every nth in Loop
- Scrolling Posts with Ajax
- Get post offset/posts page offset in single post page (outside the loop)
- display post format text in loop
- Closing the loop…featured image variable based on post id
- using wp_get_attachment_image_src in foreach loop
- How to print redux gallery feilds id? [closed]
- Multiple instances of Featured Image Thumbnail As A Background On Homepage
- Fetching posts from wordpress function in ajax
- How to render the single post template with the post name?
- Using jQuery .after inside loop
- Getting selection of posts based on loop variables via Ajax
- Excluding post thumbnail from the attachment.php when using wordpress gallery
- Thumbnail Image Rounded Corners w CSS (or any other good method)
- Loop order issue with Ajax filter
- $post is undefined in wordpress loop [ajax]
- Database query and get_user_meta return incorrect data
- Submit form for loop of products of the term with AJAX
- Get a specific size from wp_get_attachment_image_src
- How to avoid appending “null” in Ajax?
- Split Content and Gallery
- How to manually define the primary loop
- Attachment Metadata inside of Loop
- Cant pull in featured Image
- Ajax category pagination problem
- setup_postdata in “loop-handling” php file called via $.ajax
- Building theme so user can change header image [closed]
- Is there a way to target only images within the loop?
- Load featured article once in a loop
- Loop doesn’t give the thumbnail the right parent (or class)
- AJAX in wordpress theme loop
- Image Attachments Query Not Working If Post Is Loaded Via Ajax
- How to split a loop into multiple columns
- Is it necessary to reset the query after using get_posts()?
- save_post + insert_post = infinite loop
- Get ID of a page containing secondary loop in content
- Bulk edit wordpress images alt and title attributes
- Build path for a custom portfolio plugin
- ACF Repeater loops and resets – where is the reset_rows() documentation? [closed]
- Having Problem On Getting WP Post Gallery Images URL
- Exclude category by slug for for each loop
- The main Loop is not starting in a custom blog template page
- connect last post with first post
- Breaking the loop?
- woocommerce stored variable
- attachment.php code or tutorial
- Turn off image captions in gallery view?
- A smarter way to display multiple loops inside a page template
- Unyson Framework doesn’t show gallery images
- How to print out menu names in the foreach loop?
- How do I style the first two posts of a loop
- Do I need to use The Loop on pages?
- How do I paginate a get_posts() request inside another page loop (Paginating childpages)
- Gallery with thumbnail carousel
- Is wp_reset_postdata() redundant after the main loop?
- While loop with bootstrap [closed]
- How to create custom popup in shop page on every loop products?
- How to separate posts loop in to two columns? [duplicate]
- query_posts clarification needed
- “the_excerpt” in loop just keeps repeating first post?
- wpdb inside foreach loop only returns first result – 2 other similar cases found [closed]
- How to loop specific Category menu from archive page?
- How can I pass additional params to a shortcode while in a loop?
- Hover a css icon width other color inside wp_get_attachment_image
- Add all category as classes in foreach loop
- Exclude posts from loop by term
- How to display a loop of custom post types in columns
- WordPress Modal showing posts not working properly
- Query posts and display all dates in repeater field in chronological order
- Multiple loops in set intervals with code in between
- Modify widget to output posts in custom order
- How do i replace the title attribute of img tag with the image caption
- Limit article to 100 characters. Can’t use the_excerpt…
- This webpage has a redirect loop issue with SSL page
- Buddypress Group Activity Loop Filter activity type [closed]
- $do_not_duplicate is not working in genesis theme
- Loop displays current page