Usually for gallery post types with lots of attachments, you would do it like this:
http://codex.wordpress.org/Template_Tags/get_posts#Show_attachments_for_the_current_post
Inside a “WordPress Loop”:
<?php
$args = array( 'post_type' => 'attachment', 'numberposts' => -1, 'post_status' => null, 'post_parent' => $post->ID );
$attachments = get_posts($args);
if ($attachments) {
foreach ( $attachments as $attachment ) {
echo apply_filters( 'the_title' , $attachment->post_title );
the_attachment_link( $attachment->ID , false );
}
}
?>
Related Posts:
- Creating a photo gallery in WordPress [closed]
- How can I alter the [gallery] markup?
- Custom wordpress gallery option
- Make a really simple gallery structure
- Modifying the media-template.php file, the right way?
- Responsive Images
- Set default link type to “file” for image galleries
- Add option to “Gallery Settings” section
- WP_Editor – Remove TinyMCE Toolbars
- Media gallery – inserting full size images without link
- Disable Linked Gallery Images If Mobile Browser
- Possible to add same caption to all photos in a gallery?
- How to Add a Custom Colum on Thickbox Media Gallery Tab?
- WordPress 3.5 Gallery Menu Order not set?
- Getting the image title/alt attribute from the gallery shortcode
- How to get post attachments in gallery post format template
- Can I attach an image to a different post?
- How do I use two different images, one as a thumbnail and one as a linked image?
- How can I show these pictures in two columns in my page?
- How to determine if a post has attached images?
- How can I make wp default gallery responsive?
- How to get clean code for a gallery?
- Gallery set to “Media file”, showing as attachment page
- Attach custom gallery to a page
- Gallery Only Displaying One Thumbnail
- How To Put Multiple Image Galleries In A Single Post?
- Add new images to top of existing gallery not bottom
- Fancybox not working. why?
- Large Media Library
- How do I create a gallery page?
- Can I nest a element within tags from default wordpress?
- Strange issue with gallery when displays 3 columns
- Can I have the same image in multiple NextGen galleries? [closed]
- Hide Gallery from the_conent
- Custom links or pages from Media Gallery
- My “Description” in gallery doesn’t accept formatting/html
- How do I export WordPress galleries?
- How to show private flickr group on a WordPress site?
- How to use the WP export and get images that are contained in a posts gallery
- How to add a list of all galleries to my sidebar?
- Is it possible to import NextGen Galleries into WordPress Galleries and convert embeds in all posts? [closed]
- Gallery Shortcode – only show first x thumbnails
- Image Gallery links to medium image instead of FULL size image
- Gallery Shortcode Showing IDs
- Can’t get the columns of galleries when the user set the column number to 3 if there are 2 galleries?
- How to make universal gallery and improve admin side of managing galleries?
- Get gallery images from page ID
- Where is image gallery information saved?
- Display number of latest images from wordpress gallery in your homepage
- How to dynamically insert in the image caption?
- Checking for ‘gallery’ shortcode using strpos always returns false
- WordPress Gallery not being output correctly/consistently
- Add #content to next_image_link()
- Change default values of Gallery Block settings
- WordPress WebSite is jumps while scrolling bottom [closed]
- Implementing Lightbox Photo Gallery in
- Gallery image caption inside link
- How to retrieve media images urls in different sizes?
- Why do the images only display in original size, not my custom size?
- Possibilities for customising the standard wordpress gallery?
- WP Gallery showing captions twice
- zip download plugin works well in localhost but not on live site
- How can we create a wallpapers gallery with different resolution?
- gallery shortcode exclude not working
- Slideshow with thumbnails
- Ipad app: Need uploaded images to go into “Gallery” as well as “Media Library”
- Workflow for users to download files?
- Can I create a NextGen gallery from a WordPress gallery
- Gallery – custom html for inserting images
- Making the caption & click through link more visible on a gallery photo
- Multiple WordPress Standard Galleries on a page stop images being displayed from other page galleries
- Getting gallery instead of single attachment
- Get caption from unattached images in gallery?
- how do i can make a preview of image gallery
- Add title tag to image in wordpress gallery
- Page WYSWIG only allowing slides
- Pulling in Column Count in Custom Gallery
- Post gallery loop with thumb and full size
- How to add more fields to wordpress galleries?
- How to refresh the Gallery images?
- next_image_link Displaying All Images Attac
- the_content() won’t load galleries on homepage
- How can I make gallery slideshow width fit to picture width?
- Change the values of numberposts gallery
- Why do all Gallery functions return null for me?
- How to display images that was uploaded in the media gallery and not by the current post?
- How to show the image caption on custom post type …?
- JavaScript Errors when Loading NextGEN Gallery [closed]
- Numberposts 1 not cooperating in 3.5
- Generated WYSIWYG gallery with individual gallery_page templates
- Multiple Galleries in WordPress 3.3.1
- How can I add hover text to images of a basic gallery on wordpress elementor?
- How to create a custom image gallery in the footer?
- Use bootstrap for wordpress gallery? [closed]
- Click thumbnail, change main image – NextGen or somethign else?
- Looking to implement a scrolling gallery in my theme
- Hover/Zoom on Lightbox gallery
- Need help making Gallery slideshow with lightbox work correctly
- How to upload multiple images per single post and display them in a gallery?
- Trouble with WordPress Gallery since update using has_block(‘gallery’