sandywp / plugins / attachments
Attachments
Attachments allows you to simply append any number of items from your WordPress Media Library to Posts, Pages, and Custom Post Types
Ready in seconds.
v3.5.11 8,000+ installs WP 3.0+

What you get inside
5 screens-
An Attachments meta box sitting below the content editor
-
Direct integration with WordPress 3.5+ Media
-
Attach multiple files at once
-
Custom fields for each Attachment
-
Drag and drop to sort
About this plugin
Extensive usage instructions are available on GitHub
Attachments allows you to simply append any number of items from your WordPress Media Library to Posts, Pages, and Custom Post Types.
Associate Media items with posts
The idea behind Attachments is to give developers the ability to directly associate Media items with any post. This is accomplished by adding a meta box to post edit screens as determined by the developer. Once Media items have been associated with a post, you’re able to retrieve those Attachments and include them directly within your template files using any specific markup you wish.
Integrate Attachments within your theme with fine grained control
Attachments does not automatically integrate itself with your theme. Since the idea behind Attachments is to allow integration of Media within posts using developer-crafted, unique markup, it’s up to you to integrate with your theme. The most basic integration includes editing the appropriate template file and adding your call(s) to Attachments. For example, if you have set up Attachments to be used with your Posts entries, edit single.php to include the following within The Loop:
<?php $attachments = new Attachments( 'attachments' ); /* pass the instance name */ ?>
<?php if( $attachments->exist() ) : ?>
<h3>Attachments</h3>
<p>Total Attachments: <?php echo $attachments->total(); ?></p>
<ul>
<?php while( $attachments->get() ) : ?>
<li>
ID: <?php echo $attachments->id(); ?><br />
Type: <?php echo $attachments->type(); ?><br />
Subtype: <?php echo $attachments->subtype(); ?><br />
URL: <?php echo $attachments->url(); ?><br />
Image: <?php echo $attachments->image( 'thumbnail' ); ?><br />
Source: <?php echo $attachments->src( 'full' ); ?><br />
Size: <?php echo $attachments->filesize(); ?><br />
Title Field: <?php echo $attachments->field( 'title' ); ?><br />
Caption Field: <?php echo $attachments->field( 'caption' ); ?>
</li>
<?php endwhile; ?>
</ul>
<?php endif; ?>
That snippet will request all of the existing Attachments defined for the current Post within The Loop, and retrieve each itemized property for that Attachment. Using the provided details you’re able to integrate the attached Media items in any way you please.
There is a lot more information on Attachments’ GitHub page. Please contribute!
Roadmap
Please see Attachments on GitHub
Usage
Extensive usage instructions are available on GitHub
Questions
- Frequently Asked Questions
Please see Issues on GitHub
sandywp / also on the shelf
Try another plugin
5.0 · 20K+ installs
Generate PDF from Your Form Submissions and Download/Email Them
4.9 · 10K+ installs
Redirect attachment pages or return a 404 error for them based on the parent post status.
5.0 · 9K+ installs
Completely remove "attachment" pages for WordPress media. Improve SEO and prevent conflicts between page and image permalinks.
Spin up a real WordPress site in seconds.
Test plugins, build a demo, hand a client a link — then squash it and start again. No local setup, no Docker.