Wordpress 2.0 Plugin: AutoLink Attachment

May 17th, 2006

As of Wordpress 2.1, it appears that this plugin is relegated to the dustbin. I have no plans to continue developing or supporting the script. The most recent version of Wordpress includes full-featured tools to upload and link to attached documents.

In order to simplify the process of associating Wordpress post attachments with posts, I wrote a quick plugin that will automate the linking process. The plugin lists ALL post attachments.

If you don’t want them all listed, right now you are out of luck. I provide a CSS class called “dd_attachments” and each attachment link is encased in a span element. By making the span element display:block, you can create a list-like appearance.

This plugin relies on new functionality built into Wordpress 2.0 and the functions it uses are largely undocumented. For some basic information on how to use attachments in Wordpress 2.0 visit the Wordpress Codex here.

Version 1.01: I’ve modified the plugin to use an unordered list rather than span elements. The more semantically correct code will behave better in RSS readers where your CSS styles are not available. Also, the attachments follow the main post content now. This works better for most users.

Version 1.02 Added an embedded stylesheet to add class with no effort! Also thanks to TJWood’s suggestions, the code is cleaner and faster. Visit TJ’s site here.

Download the latest version of autolink attachment plugin for Wordpress 2.0

Autolink Attachment with Description

This version is a fork of Version 1.02 that adds the attachment description from each attachment, if there is one. If no description is given, it functions exactly like version 1.02. There’s a new CSS hook on the description paragraph named “dd_description”. Hopefully, this will help someone out there in cyberspace.

Download the latest version of autolink attachment plugin with description for Wordpress 2.0

Entry Filed under: WordPress

Bookmark This: del.icio.us:Wordpress 2.0 Plugin: AutoLink Attachment digg:Wordpress 2.0 Plugin: AutoLink Attachment newsvine:Wordpress 2.0 Plugin: AutoLink Attachment blinklist:Wordpress 2.0 Plugin: AutoLink Attachment furl:Wordpress 2.0 Plugin: AutoLink Attachment reddit:Wordpress 2.0 Plugin: AutoLink Attachment Y!:Wordpress 2.0 Plugin: AutoLink Attachment

12 Comments

  • 1. bscharg  |  May 19th, 2006 at 2:31 pm

    The government is currently requiring websites to be user accessible to disabled people, including the blind. CheckEngine USA
    does a great job of being usable, sustainable, and accessible for all sorts of users.

  • 2. tjwood  |  June 2nd, 2006 at 4:51 pm

    Thanks for the plugin, it’s nice and simple and does exactly what I want.

    However, there are a couple of tweaks I had to make to the SELECT query: firstly change wp_posts to the appropriate table name (e.g. if you use a different prefix).

    Also I added ' AND post_status = \'attachment\'' to the end of the query.

    This prevents an empty “Files:” link from appearing on every page that has a subpage, even if it doesn’t have any attachments, and you can also remove the “if ($dd_attachment -> post_status == ‘attachment’)” clause, since it’s now guaranteed to be one. Together this should make the code just a tiny bit quicker, since it doesn’t have to loop through loads of useless query results and perform a check for each one.

  • 3. Harvey Ramer  |  June 2nd, 2006 at 8:23 pm

    Thanks tjwood!

    I’ve altered the code according to your suggestions and it is a great improvement. I hadn’t caught the display problem yet and you nailed the fix!

  • 4. codekid  |  August 24th, 2006 at 2:34 pm

    I was just wondering if anyone could help me with a problem I’ve having…

    All I want to do is mod the plugin to write out the attachment description as well as the link, but all I’m getting is either code which freezes or gets hijacked with the post’s information rather than the attachment’s…

    I’m sure its a simple simple fix, inspired by my low understanding of both php and word press, but helping me will help me learn from my mistakes :)

  • 5. Harvey Ramer  |  August 24th, 2006 at 7:15 pm

    I just posted a second version of the plugin with that pulls the description text from the database and displays it in a paragraph element with the class ”dd_description”. I haven’t added any style information to the stylesheet, but the hook is there for you to use at your descretion.

    Here’s the link

  • 6. codekid  |  August 25th, 2006 at 10:09 am

    Now I understand :)

    PHP array structures were throwing me, plus I hadn’t quite got my head around the way attachments are handled as posts, but both are becoming clearer now..

    Thanks for your help!

    ck.

  • 7. mlcjohnson16  |  September 1st, 2006 at 1:57 pm

    I keep getting this error. When i activate the plugin. I don’t know much about PHP - but I can usually figure stuff out with accurate descriptions. If you can help - please do! Thanks!

    Warning: Cannot modify header information - headers already sent by (output started at /var/www/nelhs/test/wp-content/plugins/autolink_attachment_w_description.php:60) in /var/www/nelhs/test/wp-includes/pluggable-functions.php on line 272

  • 8. Harvey Ramer  |  September 1st, 2006 at 2:03 pm

    I’m quite sure that during the process of copying and pasting the plugin, a space has been added after the last ?>

    Removing the whitespace should cause the error to vanish in a puff of smoke. :)

  • 9. Attachment List WordPress&hellip  |  October 29th, 2006 at 8:48 pm

    [...] Inspired by 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. [...]

  • 10. WP Plugins DB » Blo&hellip  |  May 20th, 2007 at 3:53 am

    [...] Visit [...]

  • 11. Autolink Attachment - Dev&hellip  |  June 5th, 2007 at 5:59 pm

    [...] Autolink Attachment Autolink Attachment Version: 1.2License: GPLDescription: This plugin creates a link to all attachments associated with your Wordpress 2.0 post. All you need to do is open or start a post, upload attachments and save the post. The files will appear automatically. No need for more work.Author: Harvey A. RamerPlugin Page Download [...]

  • 12. WordPress Plugins Databas&hellip  |  October 13th, 2007 at 7:10 am

    [...] Visit [...]


About Harvey Ramer

CSS Web design, e-commerce Web design, and internet marketing issues from the desk of Harvey A. Ramer at Design Delineations.

View Harvey Ramer's profile on LinkedIn

Harvey Recommends

Design Notes: A CSS Web Designer’s Blog at Blogged

Calendar

May 2006
M T W T F S S
« Apr   Jun »
1234567
891011121314
15161718192021
22232425262728
293031  

Most Recent Posts