Ever since about WordPress v2.6 or so, images you uploaded and inserted into a WordPress post were created as attachments, a sub-post type that belongs to the post or page they are attached to. These attachment posts can be given their own template, and indeed they look for one when you visit the attachment’s permalink. The K2 theme ships with image and attachment templates (named image.php and attachment.php in the theme template hierachy) and displays the file along with some meta data and, if the image is a part of a gallery (or there is more than one attachment on the post), navigation aids to move from one attachment to the next. For many sites this is ideal, but if you want to just give people the file, and avoid having to create these attachment templates, then here’s a neat trick I cooked up on a recent project.
Continue reading ‘Image/Attachment Templates for WordPress’
Tag Archive for 'image'
Image/Attachment Templates for WordPress
Published on July 26, 2010 in articles by Eric Marden. 0 Comments Tags: attachment, image, post types, templates, themes, wordpress.
comments