In WordPress, every single file you upload is added to the Media Library. This applies to all kinds of files: images, documents, or even videos.
However, when the upload process is done from a specific post, the file will become attached to that post. This is a very subtle functionality native to WordPress that allows you to create galleries and image slideshows in specific posts, such as portfolios or services.
How to Attach an Image to a Post
The process of attaching an image or file to a post is simple:
- First, open the edit screen of the post you wish to attach images to.
- In here, click the Add Media button to open the upload interface
- Click on Upload images, or simply drag all the files into the upload popup
- You are done.
The moment an image gets uploaded through the media upload popup of a post, that image becomes marked as an attachment of a post. You don’t need to do anything else besides ensuring that the image was uploaded correctly.
This process doesn’t affect your uploads in any way, and you can use them just like any other file uploaded to WordPress. However, since they are now associated to a specific post, a theme can automatically display them without you having to do anything else.
To remove an image attachment, you may need to delete the media file from your WordPress installation.
Unattached Images In The Media Library
Be aware that if an image is uploaded through the Media Library directly, it will not belong to any post whatsoever and will be marked as unattached. However, you can manually attach it to a specific post by clicking on the Attach link shown in the Media list view.
How Are Attachments Used In Our Themes
Our themes make use of this feature primarily in portfolio items. Once you have attached any number of images to a portfolio post, you can then choose to display them in a number of different layouts:
- Featured image
When displaying a gallery of slideshow, be aware that the image marked as the featured image will not be used. This is to provide you with more flexibility, since you may want the thumbnail of the portfolio (defined by the featured image) to be different from the actual contents.