When using the [ gallery ] shortcode, the individual photos are linked to the photo attachment page in the rss feed e.g when your visitors click on the above first photo in Google Reader, they are brought to the thumbnail attachment page ( Which may be confusing to your visitors if your theme does not have a nicely formatted attachment.php file.

The [ gallery link=file ], which should open the full image directly, also doesn’t work. Not ideal either as I prefer my visitors to view my post rather than simply view all the images from Google Reader. In this case, I would rather they be redirected to the parent post (

So I created a new file – attachment.php in my theme directory and insert the following code. If your theme directory already have a attachment.php, you can insert the code in the very first line.

header( 'location:' . get_permalink( $post->post_parent ) );

Browse and Share

» Subscribe to Feed
» Leave a Comment

Related Posts:
» WordPress 2.8 Theme Changes
» How to Show Only Parent Category in a Post
» WordPress 2.7 Theme Changes

» Newer Post:
« Previous Post: