WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Add Navigation to Attachment Page in 2011 (10 posts)

  1. AtlantisLabs
    Member
    Posted 2 years ago #

    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,

    Drew

  2. esmi
    Forum Moderator
    Posted 2 years ago #

    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.

  3. AtlantisLabs
    Member
    Posted 2 years ago #

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

  4. AtlantisLabs
    Member
    Posted 2 years ago #

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

  5. AtlantisLabs
    Member
    Posted 2 years ago #

    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:)

  6. esmi
    Forum Moderator
    Posted 2 years ago #

    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...

  7. AtlantisLabs
    Member
    Posted 2 years ago #

    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.

  8. esmi
    Forum Moderator
    Posted 2 years ago #

    Try:

    <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...

  9. AtlantisLabs
    Member
    Posted 2 years ago #

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

  10. AtlantisLabs
    Member
    Posted 2 years ago #

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

Topic Closed

This topic has been closed to new replies.

About this Topic