Refer to the Template Hierarchy for attachment post types:
- `$mimetype.php
$attachment.phpsingle-attachment.phpsingle.phpindex.php
So for an image attachment, name your template file image.php.
Then, to link to the single post view for an attachment, you would link to it like any other post: get_the_permalink( $postid ).
Related Posts:
- Thumbnail Image to go in the post aswell
- Is possible to do this from function.php
- How to detect single.php (but not single-portfolio.php)?
- removing inline styles from wp-caption div
- Add custom Attachment Display Setting for images
- Custom Single Post By Category
- Using single.php from plugin folder instead of default template folder
- How to get Images included in Post
- disable WP automatically inserted line breaks after an image
- Find the post an attachment is attached to
- Delete the original big size image after upload and leave only 3 images crunched by media gallery
- Custom permalink structure only for default posts
- Post slugs and images cannot have same name?
- Related Posts by Multiple Tags?
- Add existing images from Media Library in to custom gallery
- Replace image attributes for lazyload plugin (data-src)
- How do I detach images from posts?
- How do I create a link that will always show the latest post?
- Download external images if post is publish
- How do I sort (order) the results from `get_children()`?
- upload image in a meta box
- Can I load posts via Ajax?
- How do I use element instead of tags in WordPress post content having webP support?
- How to remove images from showing in a post with the_content()?
- Post X of Y in single.php / sidebar.php
- HTML code in Custom field
- Unattaching images from a post
- how to display post content without post image?
- How to wrap every image in a post with a div?
- upload featured image from front end using wordpress add media button
- How do I create Comma Separated list of attached image ids?
- How to have different content in the loop and single
- Single.php Active Category Class
- Get post embedded image caption
- how to grab first link in post… and of course call it
- Load post content into div with ajax
- How to add shortcode tags in single.php [closed]
- get_terms parent for current product only
- custom single.php not working
- Add an image box besides featured image?
- Remove image from post also removes photo from media library
- Limit function to specific post category
- How to display different single post template based on author?
- Post taxonomy from exif data
- Remove inline width from figure
- All my inserted images gets a link to the full image even if it is already full size image
- how load content as pop-up using ajax
- Disable single post page
- how to know if the post has pagination () or not
- Remove arrows from previous and next link
- get custom image size
- “next_posts_link” and “previous_posts_link” display me NOTHING
- Remove permalink from images when inserting into post
- How to get only text from wordpress post content?
- Get all images out of the posts content
- How to disable single post view in wp
- how to replace embedded “full” sized images within a post with the “large” ones
- Custom Post Templates
- Add code just after Post content
- Pagination on single post page?
- WordPress Theory Lesson – Image Columns within posts with alignment?
- Batch process: remove first image from post content
- how can I put an image in a post with original size
- Restrict post navigation to current sub menu
- Show featured image next to post-teasers in Genesis Framework?
- Get image from post’s gallery
- Image Insert into posts and pages not working after 3.2.1 update
- How to retrieve the postID in a “image_send_to_editor” hook function?
- Can’t get the_content of the parent page from its single post?
- Copying and pasting emoji in a wordpress post
- Show all posts in sidebar in single.php
- Comma separated all attached image ID numbers except featured image ID number
- Modify Image Source With The_Content Filter?
- How to display featured image without it appearing in post?
- Can I use images as anchor tags with
- Featured Image uploaded, attached and set but only appearing in the media library
- Load post attached images on a single page site with fancybox
- How to show single post page as home page
- Using wp_list_categories like the the_category (showing just current categories of a post)
- creating front end image uploader that uploads images as posts
- Errors when uploading images in WP 3.5
- How can I make a post that belongs to a category or have specific tags, display different from the other single posts?
- Display all posts that were published before full post on single.php
- Format the Layout of Images In The Edit Post Textarea?
- Set size for attachments
- I have a site where attachments in the wp_posts table have guid values of guid, how did this happen?
- CSS: How can I show a photo beyond the template’s column, but contained within the browser window? [closed]
- Get all attachment by post excluding featured and content inside
- wp-cli post create & media import issues
- Get attachments for posts that belongs to a specific category
- List all categories with featured image from post?
- Add Read More Tag to a post content (Single.php)
- If in_category not working for multiple single.php pages
- Get all images in post and comments like Twitter before post title
- Show only posts with images and a fixed amount of posts
- Issue where WP Featured Image will not display
- How would one change the default url structure of attachments?
- Single.php – Get Current Parent Category
- If statement to check if post has image
- Insert sometext after first h3 in content