WordPress.org

Ready to get started?Download WordPress

Forums

Can image.php shows only attachment form [gallery] (2 posts)

  1. aculine
    Member
    Posted 1 year ago #

    Hi,
    I use native gallery function and a modified version of image.php to enlarge the gallery items. (using image.php instead of fancy or similar grow up my page-views...)

    But the problem is that when I use next_image_link() and previous_image_link, image.php load an attachment image on the whole post, not just the [gallery] ids.

    this is the code:

    <?php 
    
    							      	$image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'full' ); 
    
    								      if ($image) : ?>
    								          <img src="<?php echo $image[0]; ?>" alt="" />
    								          <br>
    								          <br>
    								         <?=$att_title = apply_filters( 'the_title' , $attachment->post_excerpt);
    
    									       	echo '<p  style="margin-top:20px;">' . the_excerpt() . '</p>' ; 
    
    								         ?>
    
    								      <?php endif; ?>
    
    							    <!--  </a> -->
    
    							<ul id="gallery-nav" class="clearfix">
    								<li class="next pull-left"><?php next_image_link() ?></li>
    								<li class="previous pull-right"><?php previous_image_link() ?></li>
    							</ul>

    Thank you.

  2. paulwpxp
    Font hero
    Posted 1 year ago #

Topic Closed

This topic has been closed to new replies.

About this Topic