You can use get_posts()
(Codex ref for getting Post attachments).
<?php
$args = array(
'post_type' => 'attachment',
'post_mime_type' => 'image',
'numberposts' => -1,
'post_status' => null,
'post_parent' => $post->ID
);
$attached_images = get_posts( $args );
?>
Related Posts:
- How do I sort (order) the results from `get_children()`?
- How to create a template for Pages?
- Give posts a particular template based on the assigned category
- How to Featured content with images in home page?
- Aligning images in the wp editor not working. How do i get this to work in custom theme?
- Integrate video and iframe in a post type gallery
- Which hooks are essential for post templates?
- Is there a block to print post link standalone in a block theme?
- removing inline styles from wp-caption div
- Post/Page Preview Template
- Find the post an attachment is attached to
- Post slugs and images cannot have same name?
- Download external images if post is publish
- My ‘post attributes’ is missing from my WordPress install
- Can I load posts via Ajax?
- how to display full post with pagination on home page
- how to display post content without post image?
- Forcing oembeds to top of post
- How to wrap every image in a post with a div?
- Post & edit a post from front end along with upload, dropdown, and other inputs
- Get post embedded image caption
- how to grab first link in post… and of course call it
- Load post content into div with ajax
- custom single.php not working
- Limit function to specific post category
- Remove inline width from figure
- Changing next and previous post link text
- WordPress Theory Lesson – Image Columns within posts with alignment?
- Why won’t my taxonomy query show up?
- Show featured image next to post-teasers in Genesis Framework?
- Category Template: Need to display different content on first page of archives
- Get image from post’s gallery
- Image Insert into posts and pages not working after 3.2.1 update
- Copying and pasting emoji in a wordpress post
- Static page does not show my posts
- How to display featured image without it appearing in post?
- How to show single post page as home page
- creating front end image uploader that uploads images as posts
- Errors when uploading images in WP 3.5
- What is the filter or hook to add admin controls to posts on the front end?
- How to use format post in a pertinent way
- Unable to restore from backup – how to obtain old blog posts?
- Get attachments for posts that belongs to a specific category
- List all categories with featured image from post?
- Get Page ID of blog homepage
- Get all images in post and comments like Twitter before post title
- custom post template file not shown, instead all the time 404.php
- Redirect to another page using contact form 7? [closed]
- How do I do a page break?
- Thumbnail Image to go in the post aswell
- Is there a way to create a meta box that can be added multiple times to a post dynamically?
- Upload attachment from external site
- How to identify and hide/remove an element from a WordPress page [closed]
- wordpress posts template remove default template from menu
- Get URL from all images in a post
- Disable posts generated from image uploads
- Image behind the post’s title
- Show more than 200 images in one post
- Hide thumbnail if there is a gallery on the post
- Image on rss feed on post
- List all native posts in template page?
- Sidebar on single.php not showing up
- Where to insert the other site image url for our wordpress post
- select post preview image from nextgen gallery
- How to get the next and previous image title from attachment or gallery?
- add_rewrite_rule and template redirect not working
- Am getting duplicate data from get_posts()
- Change modified date to current date when title updated automatically
- How to allow WordPress to recognize a custom URL segment after a product URL and use a custom template?
- unable to write to the database while uploading images
- Display image gallery if more than 1 image
- Post not using taxonomy template
- Center crop the feature image
- How to wrap image tag into div for post only?
- Add another feature image box
- How to get value of a selected option from select tag and use it in WP_query to filter posts?
- ‘posts’ table should not store the absolute image path
- How to Display Most View Post in the template file?
- How to make an image appear as a thumbnail in the blog post?
- Set featured image on creating new post
- Display post order ranking within wordpress loop
- Is it possible to query a category with specified posts?
- Trim excerpt to first paragraph
- How can I alternate styling of images in a post? [closed]
- Customizing individual images on posts
- How to change post template via url?
- Update all images url imported from HTML pages
- My blog “page” used to show a list of posts, but now it’s just showing the page content?
- Custom template for different post types
- WP Load post with ajax and apply isotope
- Posts page template: How can I edit the markup for this?
- Display the current post author and his url in the post header
- Post thumbnail dependant on category
- Latest news mini images
- Only show posts with image and the correct ammount of posts in loop
- Extra Theme – Fit image inside of Featured Post Slider
- custom post type single page template not working
- Convert HTML5 to WordPress theme
- Full width images within post content
- Download button under all images WordPress