Support » Themes and Templates » Add Navigation to Attachment Page in 2011

  • Resolved AtlantisLabs


    I am using the 2011 theme to post mostly galleries. I have the photos open in the attachment page template. I would like to do two things:

    1. Have the attachment page open in a new window; and

    2. Add a button/navigation near the forward and backward button at the top of the attachment page template to go back to the original post for that particular gallery – so this would have to be a dynamic link that involves coding I don’t know – NOT simply a link Home.

    I know very little coding, but can follow instructions well – any help would be appreciated.

    Many thanks in advance,


Viewing 9 replies - 1 through 9 (of 9 total)
  • esmi


    Forum Moderator

    Do not edit the Twenty Eleven theme. It is the default WordPress 3.2 theme and having access to an unedited version of the theme is vital when dealing with a range of site issues.

    Create a child theme for your customisations. Once your child theme is active, we should be able to help with the customisation.

    So let’s say I already modified the theme – I should be able to delete it, reinstall it then make a child theme, right?

    Or should I start from scratch and reinstall WordPress – I have done a lot of non-theme work I don’t want to redo?

    Okay, I think it worked. I deleted 2011, then re-loaded it. That seemed to remove my changes. I then created a child theme. I am assuming anything I want to change, I can just copy over to the child, and then make the changes. So in this case I want to change the attachment template, so I copy that into my child theme, and then make the changes – any help with the changes would be appreciated (adding the navigation item) and thanks to esmi for setting me on the right track:)



    Forum Moderator

    I am assuming anything I want to change, I can just copy over to the child, and then make the changes.

    Correct. And your changes won’t be over-written when you upgrade the parent theme. Creating a modified attachment.php in your child theme will take care of #2. With regard to #1, I think that you’re going to have to start looking for a plugin that might launch new attachment windows for you. FWIW, that kind of behaviour on a site would drive me nuts if I was using it. Just something to keep in mind…

    You are absolutely right about the new pages for links – I went through and changed all those – that would drive me crazy – so now I just need to figure out had to add a navigation button to the attachment page to go back to the post page.



    Forum Moderator


    <p class="posted-under"><?php _e('Posted under');?> <a href="<?php echo get_permalink($post->post_parent); ?>" rev="attachment"><?php echo get_the_title($post->post_parent); ?></a></p>

    Bear in mind that this links back to the attachment’s parent posts – not the post that the visitor previously viewed – if you know what I mean…

    I am looking to attach to the attachment’s parent’s post, so I will give this a try – thanks again.

    Thanks esmi – you are awesome – the code works perfectly!

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Add Navigation to Attachment Page in 2011’ is closed to new replies.