• So I want to include galleries in posts, and I want to be able to click on the next and previous photo in the gallery when I’m on the attachment page.

    (PHOTO)

    (previous photo) (next photo)

    I looked in the docs page, and I found this (<?php previous_image_link( $size, $text ); ?>) which I placed in attachment.php

    But nothing shows up. Am I doing something wrong?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Try:

    <?php previous_image_link(); ?> <?php next_image_link();?>

    Thread Starter scrambled

    (@scrambled)

    Still nothing, unfortunately.

    Here’s attachment.php:

    <?php get_header() ?>
    
    	<div id="container">
    		<div id="content">
    
    <?php the_post() ?>
    
    			<h3 class="entry-title"><a href="<?php echo get_permalink($post->post_parent) ?>" title="<?php printf( __( 'Return to %s', 'sandbox' ), wp_specialchars( get_the_title($post->post_parent), 1 ) ) ?>" rev="attachment"><?php echo get_the_title($post->post_parent) ?></a></h3>
    
    			<div id="post-<?php the_ID() ?>" class="<?php sandbox_post_class() ?>">
    				<h3 class="entry-title"><?php the_title() ?></h3>
    				<div class="entry-content">
    					<div class="entry-attachment"><a href="<?php echo wp_get_attachment_url($post->ID) ?>" title="<?php echo wp_specialchars( get_the_title($post->ID), 1 ) ?>" rel="attachment"><?php echo basename($post->guid) ?></a></div>
    					<div class="entry-caption"><?php if ( !empty($post->post_excerpt) ) the_excerpt() ?></div>
    <?php the_content() ?>
    
    				</div>
    
    <?php previous_image_link(); ?> <?php next_image_link();?>
    
    			</div><!-- .post -->
    
    		</div><!-- #content -->
    	</div><!-- #container -->
    
    <?php get_sidebar() ?>
    <?php get_footer() ?>

    Any ideas?

    That template file doesn’t contain a Loop. Have a look at the attachment.php file in the Twentyten theme.

    Thread Starter scrambled

    (@scrambled)

    It looks like nothing I change (even deleting something like the header code) in attachment.php affects the actual image page. Does anything in functions.php need to be modified?

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Attachment page: click thumbnail to navigate images’ is closed to new replies.