The Secret Section in WP that Lets You Change Default Image Links
Images are often hugely important on a site. But are you taking advantage of yours as best you could?
By default in WordPress, when you click on an image, you will be taken to a full size version of the picture with nothing else around it. It will typically look something like this — just the image with some type of gray or black or white background.
What you see there is the image using the “media file” setting.
However, that’s not your only option for images. You also have the option of making your images use the “attachment file” setting.
Attachment templates vary by theme, but typically they will look more like your regular site with a header, a footer, maybe even a sidebar, and possibly some other things too, like advertising.
Here’s an example of an image opening on an attachment template.
Obviously there’s a lot more going on there, and some people prefer that. It could lead to more engagement, more advertising, more page impressions, etc.
While you can change where the image links to from the media library (see below), obviously that’s a pain.
And if you forget to change one image, unless you know the code to slip into your post’s HTML section, essentially the only way to change it is to go back into the media library again and search out the image.
Setting Attachment Template as the Default
And so if you prefer using your attachment template, you can change WordPress so that it will default to the attachment file.
Never seen that setting? There’s a good reason. It’s hidden.
In order to get to this “secret” page, you’ll need to append /wp-admin/options.php to the end of your URL.
So, go to yoursite.com/wp-admin/options.php.
When you get on that options page, you’ll see a lot of choices. Search for image_default_link_type.
And when you find that, put the word post into the box. (You will probably find the word file in there already. That is what’s causing it to go the to the media file only.)
Go all the way to the bottom, hit “Save Changes,” and you’re done. You site’s images should now be set up to go to your attachment page.
Your Theme’s Attachment Page
The look of your attachment page is controlled by your theme. Of course you can edit that if you feel comfortable doing so.
The hierarchy for the attachment file is the following:
This means that if you have an image.php file in your theme, that is what WordPress will take over all the others. If you don’t have an image.php file, but you have an attachment.php file, then it will take that template, etc.
As always, if you’re changing your theme’s template files, then you’ll probably want to make a child theme if you haven’t already done so.
Photo credit: square pictures at an exhibitionTags: