WordPress Attachment Manager Plugin

Posted by Aaron D. Campbell | Friday, January 5th, 2007
, ,

This WordPress plugin allows you to create a list of attachments on your messages (as seen in areas of this site). You can choose to show them on all posts, some posts (adds an option to the “Write” page), or not show them at all. Even specify whether you want to show files that are already linked in your post or not.

The icons are also customizable. You can choose whether to show icons with the files (uses “Silk” by famfamfam by default), and can even specify what icons go with which file extensions, as well as add your own icons (and remove the ones that are there).

I welcome any suggestions or bugs, and while you are at it, you can check out my other WordPress plugins

Changelog

05/12/2008: 1.0.1
  • Fixed problem with plugin causing custom excerpts to not be shown
01/14/2008: 1.0.0
  • Added to the wordpress.org repository
06/28/2007: 0.1.3
  • Added support for WP 2.2.x-s
01/10/2007: 0.1.2
  • Added the option to not show file lists on excerpts
01/07/2007: 0.1.1
  • Added the option to not show file lists on category pages
01/05/2007: 0.1
  • Original Version

Related Posts:

51 Responses to “WordPress Attachment Manager Plugin”

  1. Nick says:

    How does one only show the file to be downloaded on the post page, rather then the category page?

  2. I’m not sure, I’ll check into it when I get a moment.

  3. Nick: There is now a setting to avoid showing the file list on the category pages.

  4. Jonas says:

    Hi!

    Have you tried it with WP 2.1? I installed and everything looked ok in the admin interface. Attached a file to a post. But nothing shows. I selected show attachments on all posts no exclusions.

  5. No, I haven’t had time to test on 2.1 at all.

  6. Cindy says:

    To work on 2.1, line 90 needed to be changed from WHERE post_status = ‘attachment’ to WHERE post_type = ‘attachment’
    Great plugin :)

  7. Jonas says:

    Hi Cindy!

    many thanks. I was browsing the SQL statements quickly to se if i found something but that one I messed. Excelent!

  8. Alex says:

    Hello, i install the plugin in wordpress 2.1 and all things looks ok but i don’t know how used it, how i can upload files and send to the post and show it like your sample? thanks

  9. ddasfd says:

    great work, keep it up!!

  10. Chris Hirt says:

    Aaron,

    I stumbled upon your attachment manager plugin and I’m excited about it. One small improvement you could make that shouldn’t be too hard (and I need it to work!) would be to make the attachment manager work in 2.1 with pages as well.

    thanks and great work!

    Chris

  11. Thanks Chris!
    Unfortunately, my work load has not allowed me any time to work on any of my WordPress plugins for quite a while. I’d be happy to allow anyone to continue the project that wants to, and even host the files here, etc. However it doesn’t look like I’ll be in a position to work on it for a while.

  12. Yongho Kim says:

    do you know how it would be possible to make the list of attachments to be displayed before the post content, and not after it?

  13. Yes, change line 71 from:
    $post_content .= wpAttachmentManager::get_attachments();
    to:
    $post_content = wpAttachmentManager::get_attachments().$post_content;

  14. samy says:

    Doesn’t Work for me

    plz some help i want to this great plugin work in out WP directory but whe in try to do this i get …

    Warning: getimagesize(wp-content/plugins/attachment_manager/icons//page_white_compressed.png) [function.getimagesize]: failed to open stream: No such file or directory in E:\EasyPHP\www\wpdb\wp-content\plugins\attachment_manager\wp-attachment-manager.php on line 123

    Warning: getimagesize(wp-content/plugins/attachment_manager/icons//page_white_compressed.png) [function.getimagesize]: failed to open stream: No such file or directory in E:\EasyPHP\www\wpdb\wp-content\plugins\attachment_manager\wp-attachment-manager.php on line 123

    Warning: getimagesize(wp-content/plugins/attachment_manager/icons//page_white_picture.png) [function.getimagesize]: failed to open stream: No such file or directory in E:\EasyPHP\www\wpdb\wp-content\plugins\attachment_manager\wp-attachment-manager.php on line 123

    how it gona work out WP directory …

    but in WP dir work fine

  15. Try removing the slash from the line that reads: $image_size = getimagesize("{$icon_dir}/{$img}");

  16. samy says:

    thnx, yes i do it but steel give me that

    Warning: getimagesize(wp-content/plugins/attachment_manager/icons/page_white_compressed.png) [function.getimagesize]: failed to open stream: No such file or directory in E:\EasyPHP\www\wpdb\wp-content\plugins\attachment_manager\wp-attachment-manager.php on line 123

  17. samy says:

    i delet that code and the problem has gone

    if (!empty($img)) {
    $icon_dir = wpAttachmentManager::get_icon_dir().’/';
    $image_size = getimagesize(”{$icon_dir}{$img}”);
    $lp = $image_size[0]+4;
    $height = $image_size[1];
    $siteurl = get_settings(’siteurl’).’/';
    $link .= ‘ class=”wam_icon_link”‘;
    $link .= ” style=’padding-left:{$lp}px; line-height:{$height}px; background-image:url(\”{$siteurl}{$icon_dir}{$img}\”);’”;
    }

    but i don’t tink that is a good adea :D

  18. Roy says:

    Warning: Invalid argument supplied for foreach() in /mnt/gs01/herd03/34864/domains/chedstone.com/html/wp-content/plugins/attachment_manager/wp-attachment-manager.php on line 228

    What’s this about?

  19. David Liddle says:

    Here’s what I see on my AM Options page:

    Warning: opendir(/homepages/41/d244192583/htdocs/wordpress/wp-content/plugins/attachment_managerattachment-manager/icons) [function.opendir]: failed to open dir: No such file or directory in /homepages/41/d244192583/htdocs/wordpress/wp-content/plugins/attachment-manager/wp-attachment-manager.php on line 295

    Warning: readdir(): supplied argument is not a valid Directory resource in /homepages/41/d244192583/htdocs/wordpress/wp-content/plugins/attachment-manager/wp-attachment-manager.php on line 296

    What do these lines look like, and how should I change them? I haven’t had any success in finding them on my own or discerning what the correct code is.

    Thanks!

  20. Aydar Unusov says:

    Любопытная статья, да и сам сайт я смотрю очень даже не плох. Попал сюда по поиску из Яндекса, занес в закладки :)

  21. cris rieder says:

    hi guys, need some help
    i have:
    - installed on wp 2.6.2, activated the plugin
    - set icons folder to 777

    i get the message

    Warning: opendir(/www/doc/www.privateproperty.cz/www/MarketInformation/wp-content/plugins/attachment_managerattachment-manager/icons): failed to open dir: No such file or directory in /www/doc/www.privateproperty.cz/www/MarketInformation/wp-content/plugins/attachment-manager/wp-attachment-manager.php on line 295

    Warning: readdir(): supplied argument is not a valid Directory resource in /www/doc/www.privateproperty.cz/www/MarketInformation/wp-content/plugins/attachment-manager/wp-attachment-manager.php on line 296

    any suggestions please!!!

    cris

  22. А кому от этого легче станет?

  23. YikYak says:

    Hi,
    I just installed your plugin and it seems to be working, looks nice based on a first successful test post.

    But it did not work “out of the box”, as I imagine it could easily do. The default directories in the options pages were not quite a match to the directory structure within the .zip, I can’t remember, but they included something like “attachment_managerattachment-manager” in the path, and I needed to tweak them. So initially I got no icons to configure and hence display.
    Cheers
    YikYak

  24. YikYak says:

    Actually, now I read a bit more, I think that matches what the earlier comments are talking about, but I did not see the error messages, I just got a not quite working plugin.

    Guys, I hope you got fixed, or are still reading comments, and my observations helps you.

  25. Bram says:

    Hi, I just upgraded to version 2.0 of your plugin and get a huge load of error messages. When, after the first shock, I started to search for the source of the error I found out that the input-field on this plugin’s options-page for Allowed File Extensions has a faulty input. Instead of something like: “jpg,jpeg,gif,png” it displays “array”.

    So there’s probably something wrong in your PHP code. After suplying the propper file-extensions in the inputfiled all the errors are gone.

    Cheers,
    Bram.

  26. baron says:

    hi. Thanks for plugin

    perfect.

    Regards

  27. Sumanth says:

    Thanks!

  28. Яков says:

    Тема эта старая конечно , но прочитал с удовольствием :)

  29. Ross says:

    Hi, great plugin! Im using WP 2.7 and I cant seem to find the option for "show attachment on this page" when ive checked "some posts". It says it should be in the "write" section, but I cant find it there. I also cant seem to be able to add for example .docx to the iconlist to show the word-icon if the attachment is a docx-file. Could you help me with this?

  30. Ross says:

    Hi again, I found th checkbox to show attachment for certain post, but what I want is a checkbox for ppages aswell! Can this be mplemented easily?

  31. Y920.com says:

    Thanks for this plug in..

  32. Alexwebmaster says:

    Hello webmaster
    I would like to share with you a link to your site
    write me here preonrelt@mail.ru

  33. Ashley Yakeley says:

    Hi, I have the same issue as Ross above. I need to show attachments on certain pages.

  34. Ashley Yakeley says:

    I fixed this. It's very simple, just add this 'edit_page_form' line beneath the 'edit_form_advanced' line (near the end):

    add_action('edit_form_advanced', array('wpAttachmentManager','post_form'));
    add_action('edit_page_form', array('wpAttachmentManager','post_form'));

  35. Ashley Yakeley says:

    I had to fix it to play nice with another plugin, User Access Manager.

    Line 105, change

    $query = "SELECT `guid`, `post_content`, `post_title` FROM {$wpdb->posts} WHERE (post_status = 'attachment' || post_type = 'attachment') AND post_parent = '{$post->ID}'";

    to

    $query = "SELECT `ID`, `guid`, `post_content`, `post_title` FROM {$wpdb->posts} WHERE (post_status = 'attachment' || post_type = 'attachment') AND post_parent = '{$post->ID}'";

    Line 132, change

    $link = "<a href='{$attachment->guid}'";

    to

    $url = wp_get_attachment_url($attachment->ID);
    $link = "<a href='{$url}'";

  36. nick says:

    is it possible to exclude jpeg's from showing as attachments in the list? i can't find an attachment manager that will only show docs/pdfs/xls, etc without showing all the jpegs associated with a post as well.

  37. age says:

    @ross : same here, no option “show attachments” on the write/edir post section
    you can add an icon for docx file an assign it, or add a name docx at the word doc icon.
    @Ashley : I did your adding line, no luck! is it the solution for ross problem?
    @nick : yes I also need that. the image file shown is also image i use for the page. keep shown when i cheked the “Don’t show files that are already linked in the post”

  38. age says:

    now the attached file I linked to the page is not shown to attachmet manager. i did checked the don’t show option. Just run well now. strange. how come.. :D

    but i still need the “some page optin @ write section” any help?

  39. age says:

    finally work well on my Xampp local server. but when I upload my WP to unix hosting, and the style and icon doenst show. I have to copy the plugin css style to main wordpress theme:(style.css): works, but the icon doesn’t show. any help?

    should I copy the icons to somewhere?

  40. Steve says:

    I have one category that I password protect all the posts – but the attachments are showing on that category page before a password is entered. I know there is a setting to avoid showing the file list on all the category pages, but I want it show on all the categories except this one. Or to not show with any password protected posts – whichever is easier. Ideas?

    Thanks!

  41. Bobby says:

    I am using Wordpress 2.7. I input the Associated File Types for the icons under options, but they would not save after I click the Update Options button. Thus, the icons would not show on the site according to the associated file types. The icon shows only when I select the default for one of the icons. Please help.

  42. Craig says:

    On a page listing tags it shows up but all the html has been stripped. it just lists Attached Files: and then lists the file title but it doesnt actually link and all the formatting is gone. How can i change this? Your help with really be appreciated

Leave a Reply

Pings/Trackbacks

  1. [...] Attachment List – Easily spice up attachment icons without [...]

  2. [...] Wordpress Attachment Manager: Interesante plugin que te permite generar listas de elementos adjuntados al post. [...]

  3. [...] Attachment List: This plugin let to use FAMFFAMFAM.com set of icons to be used in place of boring attachments appearing with Word Press posts. [...]

  4. [...] Attachment List – легкое украшение ссылок для скачивания без кодинга. [...]

  5. [...] Wordpress Attachment Manager Plugin Filed under: Uncategorized by Catherine Farman @ 3:36 pm addthis_pub = ‘cginanni’; addthis_options = ‘favorites, email, digg, delicious, myspace, facebook, google, live, more’; [...]

  6. [...] Attachment List: semplice plugin che permette di sostituire le vecchie icone che appaiono sugli allegati di un post. È possibile utilizzare questo plugin per sostituire l’icona di default utilizzata da Wordpress con una nuova serie di icone, disponibili gratuitamentesu FAMFAMFAM.com. [...]

  7. [...] Attachment List – Easily spice up attachment icons without [...]

  8. [...] Attachment List – Easily spice up attachment icons without coding [...]