Support » Themes and Templates » Make image attachment page Title link to the page with gallery

  • Resolved gr8


    Hi. I would like to have the image attachment page title link to the page I’ve added a default image gallery on my Twenty Twelve child theme.

    So when a thumbnail is clicked on and the attachment page opens it gives the previous or next image link options and I would like to make the titles (h1 class entry-title pagetitle h1) of the gallery’s image attachment pages link to the page that the gallery was attached to.

    I have added an image attachment template php file to my child theme and just can’t figure out how to link the h1 title back to the page I added the galley to.

    This is pretty much a stock twenty twelve child theme and the default image gallery set to attachment page so I don’t imagine a link to my site would help. Any suggestions would be greatly appreciated, need sleep:)

Viewing 1 replies (of 1 total)
  • Asking the correct question was the answer. This adds an additional linked “page title” (not entry title) that returns to the page where the images are attached. In the attachment image template php of my twenty twelve child theme I added:

    <?php if ( ! empty( $post->post_parent ) ) : ?>
    					<p class="page-title"><a href="<?php echo get_permalink( $post->post_parent ); ?>" title="<?php esc_attr( printf( __( 'Return to %s', '' ), get_the_title( $post->post_parent ) ) ); ?>" rel="gallery"><?php
    						printf( __( '<span class="meta-nav">←</span> %s', '' ), get_the_title( $post->post_parent ) );
    				<?php endif; ?>
Viewing 1 replies (of 1 total)
  • The topic ‘Make image attachment page Title link to the page with gallery’ is closed to new replies.