WordPress.org

Ready to get started?Download WordPress

Forums

If Next Image (5 posts)

  1. alanchrishughes
    Member
    Posted 1 year ago #

    I've been working with WordPress' built in gallery feature and have back/next buttons below the individual attachment pages/images, but the problem I am having is when I am at the first or last image in the gallery and there isn't a previous or next image, the button disappears. I tried the code below, but I don't think the get_next_post is right, it should be something else like if_there_is_another_attachment_in_your_wp_gallery_blah

    <?php
    
        if ( get_next_post() ) {
    
           next_image_link( false, '<img src="/next.jpg">' );
    
       } else {
    
          next_image_link( false, '<img src="/next.jpg">' );
    
       };
    ?>
  2. alanchrishughes
    Member
    Posted 1 year ago #

    This seems to work to generate a basic next image link that I can apply to an img, but there isn't an equivalent to use for previous images.

    http://wordpress.org/support/topic/gallery-click-on-image-to-view-next-image-how?replies=9#post-894961

  3. alanchrishughes
    Member
    Posted 1 year ago #

  4. alanchrishughes
    Member
    Posted 1 year ago #

    any ideas greatly appreciated :)

  5. alanchrishughes
    Member
    Posted 1 year ago #

    what about

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.