Inspired by, and based on, Harvey Ramer's Autolink Attachment Plugin, this plugin lists attachments to a WordPress 2.x post in a list following the text. Only attachments that are not already linked to or displayed in the post text will be shown (this is mainly to prevent inline images from being listed).
Attachments are shown with an icon mapped to their file extension from Mark James' excellent Silk icon set. The attachment's title will be used for the link name and, if the attachment has a description, it will be shown below.
Update Feb 7, 2007: I've put together a new version that fixes the CSS typo (oops!), the post id issue Pete mentioned, and is now compatible with WP 2.1. There's also a version available that just fixes bugs for WP 2.0 users.

28 Comments (comment feed)
Great plugin, been looking for something like this for a long time!
I’ve found a small bug though - CSS path in the php file is set to /wp-content/plugins/show_attachments/attachment.css, while the default folder name for the plugin is attachment_list. Might be a bit confusing for WP newbies ;)
Another thing - is it possible to add attachments from the Browse All window ? So far the user has to upload files to get them attached. Maybe an “Attach file” button to the context menu ?
$content ?
rb_get_attachments($content=???);
Hi Reid, you could add something like this to the beginning of rb_get_attachments (I’m not a coder so modify as you see fit)
if (!isset($post->ID)) return “”; // jump off when creating a post and ID not set.
Otherwise the plugin may bug when publishing directly without saving first, when ID is not yet set.
sorry ->
if (!isset($post->ID)) return $content;
Service Temporarily Unavailable..
Silk icon set
Cant see the example
Icons is not published. I’m using Silver Lexus theme and i see the classic unordered list after Attachment List plugin installation.
Tnx in advance.
Hai Pete, its a good plugin, thank you
Hi!
First of all, congratulations, this is an excellent plugin. I’m kind of new to WordPress and I am trying to achieve something with your plugin. Basically, I don’t want the attached files to show up on my main page since only extracts of articles are shown (using the comment—more— html tag), but I want the attachments to be shown when the whole article is shown. Do you know how I could implement that?
Thanks!
I also encountered Red’s CSS problem. To correct it, change line 33 of attachment.php to
print "";Last try:
print “”;
Your blog does not like code :(
Does anyone use this plug-in with WP 2.1.1 already? I had it working with 2.0.7 but it doesn’t seem to work with 2.1.1.
It is working again. In 2.1.1 some database column names (or their meaning) have changed (did any one see this documented?). Replace post_status by post_type in attachment.php and then it should be working again.
Ok, color me clueless here, but how exactly does one attach a file? There’s no readme file to explain how this thing works, and your explanation above doesn’t exactly make sense.
You attach a file using the upload form on the post page. It’s already a part of WordPress, most commonly used for photo uploading, but it will work with any file you want. Whenever you upload something while editing a post, it’s attached to that post in the database.
This is a great plugin!
I’ve been looking for a plugin like this for whole day, and final i choose to use this one. It’s easy to install and work nicely with my wordpress.
Thanks.
Can I have the attachment hide in the frontpage?
Is there anyway to implement it?
Thanks for your help
hi,
i have problem with this plugin, when it’s activated, TinyMCE don’t work, when it’s deactivated, everything it’s ok…
wp version 2.1.1
plugin version 1.1
any suggestions?
thx
Hi, any way to make the attachments not appear on a secure page until the password is entered? Right now it appears below the password field even before it has been entered…
Many thanks!
The path to this plugin’s CSS file does not work for blogs that are not installed in the root. This can be fixed like this. After:
function rb_attachment_css() {
… add this line: …
$siteurl = get_bloginfo(‘url’);
Otherwise $siteurl is empty and the CSS path is root relative, not site relative. This method makes the CSS path absolute so it works.
Odd: Your description says “Only attachments that are not already linked to or displayed in the post text will be shown.” That’s actually the opposite of the behavior I’m looking for (I want to show icons if a post includes an image, audio, or video; and I wouldn’t want an icon for a file that’s merely attached but not included in the post body), so I was going to mod the plugin to reverse the behavior. But then I discovered that icons are displayed regardless whether media is embedded in the post or merely attached to it (i.e they’re displayed in all cases). So it seems that your description might be off on that point?
Hi, this plug in is exactly what im after..however can i limit it to only effect PDF and WORD docs so for example i can still put jpegs into the text etc.
Thought you may be interested in something I added. I needed to be able to show the attachment list in the full post, but not in the short version when using WP’s “more” break in posts so I included the following code just after the line ‘if (!isset($post->ID)) return $content;’ …
if ( preg_match(‘//’, $post->post_content) and !preg_match(‘//’, $content)) return $content;
Just returns the content if it does contain a more tag and doesn’t contain the more span in the full post.
I also noticed that ‘if (!is_single()) return $content;’ works as well for my scenario without any of the regex-matching slowdowns since all my “more” tagged posts are in list-form when I don’t want the attachment list showing.
boo, the preg match things got stripped… lets try this again… they are:
andnevermind
Hey, just thought i'd throw in a quick addition i made. i needed to only query documents, and not pictures. so i changed the $rb_attachments to use the internal wordpress attachment function allowing me to get a particular mime type. this saves you a direct query.
$rb_attachments = get_children(array(‘post_parent’ => $post->ID, ‘post_type’ => ‘attachment’, ‘post_mime_type’ => ‘application’, ‘orderby’ => ‘menu_order’));
if($rb_attachments) {
great plugin!
eric,
i need the attachment list to do the same thing—ONLY show non-jpeg doc’s attached like PDF, XLS, DOC, etc.
I tried to implement the code you said you inserted but couldn’t get it to work.
can you post the complete code with the changes so i can try to get the same results?
thanks,
nick
10 Trackbacks
[…] Attachment List lists attachments to a WordPress 2.x post in a list following the text with an icon based on their extension. […]
[…] Attachment List listet alle Anlagen zu einem Beitrag nach selbigem auf, zusammen mit einem Icon basierend auf der Dateiendung. […]
[…] Attachment List lista los anexos de un post en Wodpress 2.0 en una lista a continuacion del texto y con un icono que se basa en su extension. […]
[…] grade dabei Reid Beels Attachement List Plugin zu testen - mal schauen ob es funktioniert […]
[…] Attachment List WordPress Plugin â Posts â Reid Beels (tags: wordpress plugin attachment plugins) […]
[…] Attachment List WordPress Plugin â Posts â Reid Beels Plugin de WordPress para adjuntar documentos a los artÃculos. (tags: wordpress plugin plugins attachment) […]
[…] Attachment List lista los anexos de una entrada en Wodpress 2.0 en una lista a continuación del texto y con un icono que se basa en su extensión. […]
[…] Attachment List lists attachments to a WordPress 2.x post in a list following the text with an icon based on their extension. […]
[…] Visit […]
[…] Attachment List Attachment List Version: 1.1License: GPLDescription: This plugin lists attachments to a WordPress 2.x post in a list following the text with an icon based on their extension. Only attachments that are not already linked to or displayed in the post text will be shown (this is mainly to prevent inline images from being listed).Author: Reid BeelsPlugin Page […]