Refer to the Template Hierarchy for attachment post types:
- `$mimetype.php
$attachment.php
single-attachment.php
single.php
index.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
- removing inline styles from wp-caption div
- Custom Single Post By Category
- Using single.php from plugin folder instead of default template folder
- How to get Images included in Post
- Find the post an attachment is attached to
- Post slugs and images cannot have same name?
- Related Posts by Multiple Tags?
- Download external images if post is publish
- Can I load posts via Ajax?
- Unattaching images from a post
- how to display post content without post image?
- How to wrap every image in a post with a div?
- how to grab first link in post… and of course call it
- Load post content into div with ajax
- custom single.php not working
- Add an image box besides featured image?
- Limit function to specific post category
- Remove inline width from figure
- how load content as pop-up using ajax
- Remove permalink from images when inserting into post
- WordPress Theory Lesson – Image Columns within posts with alignment?
- Get image from post’s gallery
- Image Insert into posts and pages not working after 3.2.1 update
- Can’t get the_content of the parent page from its single post?
- Copying and pasting emoji in a wordpress post
- How to display featured image without it appearing in post?
- Featured Image uploaded, attached and set but only appearing in the media library
- How to show single post page as home page
- 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
- 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
- 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
- Issue where WP Featured Image will not display
- Single.php – Get Current Parent Category
- Remove Featured Image & All Media Uploaded to the Post
- preg_replace not removed “class”
- Single Post in Tab/Slider
- Upload attachment from external site
- Get URL from all images in a post
- Disable posts generated from image uploads
- Defined function isn’t showed on page
- Images showing up in Post Editor, but not in Published Post
- Image behind the post’s title
- How to retrieve certain number of images from a wordpress post?
- Show more than 200 images in one post
- Hide thumbnail if there is a gallery on the post
- Image on rss feed on post
- Change the background of each post according to the category
- Where to insert the other site image url for our wordpress post
- select post preview image from nextgen gallery
- Changing wp_link_pages() to “Next Page” and “Previous Page” buttons?
- Making a wordpress page print friendly
- “Home” Page now only displaying the single latest post
- Aligning images in the wp editor not working. How do i get this to work in custom theme?
- unable to write to the database while uploading images
- Display image gallery if more than 1 image
- WP posts using index.php instead of single.php
- Post images are not displayed in media library
- Delete attached images from posts
- Single post shows post three times
- Center crop the feature image
- Schedule image post on download
- Add another feature image box
- ‘posts’ table should not store the absolute image path
- How do I check if a post is password protected?
- display multiple posts and posts content on a single URL
- How to make an image appear as a thumbnail in the blog post?
- Set featured image on creating new post
- Get the category of post
- How can I alternate styling of images in a post? [closed]
- Customizing individual images on posts
- Custom Single Post Type not referring to single-post-type.php File
- Update all images url imported from HTML pages
- Thumbnail With Next/Prev Links Not Showing Next Post?
- Featured Images link to post parent
- Pagination and Related Posts
- Single post page from static home not working
- Post thumbnail dependant on category
- Get current post’s child page?
- Latest news mini images
- How do I insert a custom field in a user submitted post?
- Only show posts with image and the correct ammount of posts in loop
- Extra Theme – Fit image inside of Featured Post Slider
- Get attachment if matches a variable
- Wrap div-tag around posts in page
- Full width images within post content
- Show Next/Previous without Link
- Broken images after importing posts and opening in Gutenberg
- Search doesn’t display posts with images
- Displaying all images from a WordPress post (including media library)
- How to move all images in a post to a single gallery for a bunch of posts?
- Inside post image title has been posting as a post title on my main post page