You can do that within the loop using wp_get_attachment_image
.
Something like (not tested):
//loop starts
//values for get_posts ( or wp query if you prefer)
$args = array(
'post_type' => 'attachment', //gets the attachments aka your images
'numberposts' => -1,
'post_parent' => $post->ID
);
// some attributes you want added to each image
$default_attr = array(
'class' => "background-attachment", //for your javascript
'alt' => 'something',
'title' => ''something
);
//loops through the attachments,
//uses the 'full' parameter assuming you want the default large image
$attachments = get_posts($args);
if ($attachments) {
foreach ($attachments as $attachment) {
echo wp_get_attachment_image($attachment->ID, 'full', false, $default_attr);
}
}
//loop ends
//your javascript for full page background via wp_enqueue_script
Related Posts:
- disable WP automatically inserted line breaks after an image
- Add existing images from Media Library in to custom gallery
- Can I load posts via Ajax?
- How do I use element instead of tags in WordPress post content having webP support?
- Add confirmation popup on “Move to Trash”
- Limit function to specific post category
- Get image from post’s gallery
- Load post attached images on a single page site with fancybox
- Redirect to another page using contact form 7? [closed]
- How to only publish posts with image in it
- How to get the next and previous image title from attachment or gallery?
- Rewrite image links from attachment id to attachment link
- Display image gallery if more than 1 image
- Colorbox not working on native WordPress gallery when gallery is loaded thru AJAX
- Integrate video and iframe in a post type gallery
- WP Gallery Image Page Issue When 2 galleries share one image
- How to move all images in a post to a single gallery for a bunch of posts?
- get custom image size
- Enabling post thumbnails for custom post type
- Remove permalink from images when inserting into post
- Run a function when post is deleted?
- How to get only text from wordpress post content?
- Checking is user author of number of posts?
- How can I remove “”
- Add container div to gallery using post_gallery
- Get all images out of the posts content
- Add scripts on custom post add/edit pages Not Working
- how to replace embedded “full” sized images within a post with the “large” ones
- Create cron job without a plugin?
- WordPress Theory Lesson – Image Columns within posts with alignment?
- Injecting JavaScript into a Post with WP3.x
- How can I get a post field value using javascript?
- Getting current post ID in functions.php
- Batch process: remove first image from post content
- how can I put an image in a post with original size
- How to rename “Publish” metabox title in post screen
- How to hide first gallery for every post?
- Show featured image next to post-teasers in Genesis Framework?
- Image Insert into posts and pages not working after 3.2.1 update
- Action hook for new pending posts?
- How to retrieve the postID in a “image_send_to_editor” hook function?
- Should a photo gallery be in a post or on a page?
- Uppercase first sentence in every post
- Add icon/badge next to posttitle of specific category
- Ajax posts filter by date, comments, top views, top likes
- Copying and pasting emoji in a wordpress post
- Prepend or add an Image to the content of a Post
- Converting a dynamic piece of code using WordPress Loop into a static one using Post ID
- Why content_arr[‘extended’] removes paragraph tags?
- Comma separated all attached image ID numbers except featured image ID number
- Modify Image Source With The_Content Filter?
- Custom post preview without saving
- How to display featured image without it appearing in post?
- Can I use images as anchor tags with
- How is a gallery associated with some post in database?
- Featured Image uploaded, attached and set but only appearing in the media library
- creating front end image uploader that uploads images as posts
- Errors when uploading images in WP 3.5
- Format the Layout of Images In The Edit Post Textarea?
- Block Editor: Reset Reusable Blocks to last saved record
- Exclude category from
- Setting posts_per_page for taxonomy term template
- Change post order random through out the entire WordPress
- Set size for attachments
- How to display the link (title) and thumbnail post?
- I have a site where attachments in the wp_posts table have guid values of guid, how did this happen?
- CSS: How can I show a photo beyond the template’s column, but contained within the browser window? [closed]
- Force the “Choose from the most used tags” meta box section to always be expanded
- Show the content that is after the excerpt using child theme
- Get all attachment by post excluding featured and content inside
- Ajaxify This Code
- How to allow users to post only in certain category and hide elements from edit page?
- wp-cli post create & media import issues
- How to do set post permalinks using 6 digit random unique function?
- Can’t get buddypress notifications in front-end; why do I get this error?
- How do I display some posts fully on the homepage, and some as an excerpt only?
- Integrate OpenStreetMap on WordPress
- Get attachments for posts that belongs to a specific category
- List all categories with featured image from post?
- Send post id through ajax and get the post content back
- Get all images in post and comments like Twitter before post title
- Display post x of y within category
- Force authors to Preview a post before publishing
- WordPress Automatic Filename Changer
- Show only posts with images and a fixed amount of posts
- Issue where WP Featured Image will not display
- posts_per_page option limits the number of Gallery items
- plugin to post from admin to flickr [closed]
- How would one change the default url structure of attachments?
- Order posts alphabetically: how to set order=asc in mysql query?
- If statement to check if post has image
- Only show a Post once in 10 visits
- Gather posts into a cart/lightbox and share with another user
- Thumbnail Image to go in the post aswell
- Remove Featured Image & All Media Uploaded to the Post
- Change all author links in Blog roll
- disable Tab post on nav-menus page (Admin)
- Adding bootstrap classes to video shortcodes
- Every second post different class in blog view
- What are the benefits of setting a “featured image” for a WP blog post?