That depends entirely on what you mean by “attach.”
Each WordPress post can already have multiple media attachments – photos, documents, etc. You upload these using the built-in uploader and they’ll all be marked as “attached” to that specific post ID.
You can refer to these later programatically elsewhere. For example, the following code will list out all attachments for a specific post (code from Snipplr):
All of this functionality is accessible via the default “Add Media” button to the far right of “Upload/Insert” on the new post screen. After you add one image, you can click “Select Files” again and upload a second image. Then a third. Then a fourth. As many as you want.
Each of these images will be “attached” to the post … even if they’re not inserted into the content.
Here is a complete tutorial with source files that do exactly what you want,
You can upload multi images by cloning the input field and also you can preview, delete images with ajax, add multi metaboxes to multiple/different post types and more.
I’d also recommend checking out http://www.wpalchemy.com . WPAlchemy is a kick ass “class” (near to a plugin) to easily add custom meta boxes to your site. I use it extensively and have been impressed by the ease of use and commitment of the developer and burgeoning community.
That depends entirely on what you mean by “attach.”
Each WordPress post can already have multiple media attachments – photos, documents, etc. You upload these using the built-in uploader and they’ll all be marked as “attached” to that specific post ID.
You can refer to these later programatically elsewhere. For example, the following code will list out all attachments for a specific post (code from Snipplr):
All of this functionality is accessible via the default “Add Media” button to the far right of “Upload/Insert” on the new post screen. After you add one image, you can click “Select Files” again and upload a second image. Then a third. Then a fourth. As many as you want.
Each of these images will be “attached” to the post … even if they’re not inserted into the content.
Here is a complete tutorial with source files that do exactly what you want,
You can upload multi images by cloning the input field and also you can preview, delete images with ajax, add multi metaboxes to multiple/different post types and more.
http://www.deluxeblogtips.com/2010/05/howto-meta-box-wordpress.html
I’d also recommend checking out http://www.wpalchemy.com . WPAlchemy is a kick ass “class” (near to a plugin) to easily add custom meta boxes to your site. I use it extensively and have been impressed by the ease of use and commitment of the developer and burgeoning community.
Yes it’s quite possible. See a response I got about metaboxes. Basically, you’ll just want to add a hook for
save_post
and verify the nonce field.