• Hi,

    What I need is for the ability to show or hide a <div> containing my next/prev controls for image galleries depending on whether or not there’re actually any other images. At the moment I have this:

    <?php if ( previous_image_link() != null || next_image_link() != null ) { ?>
    <div class="page_controls">
    	<div class="wp-caption alignleft">
    <?php previous_image_link() ?>
    	</div>
    	<div class="wp-caption alignright">
    <?php next_image_link() ?>
    	</div>
    </div>
    <?php } ?>

    But this isn’t working. It echoes out the prev/next links as usual, but not all the <div>s in my if statement.

    I’m fairly sure my if statement is invalid, but I don’t know what to do to make this concept work. Hopefully my code is enough to demonstrate exactly what I’m after, though.

    I really hope someone can help me out as I’ve torn my hair out for an hour trying to do this myself. :~

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter RyanWilliams

    (@ryanwilliams)

    Anyone in the evening crowd got any ideas for this? Sorry for bumping, but I did post it in the dead of night and it’s already been knocked a mile down. 😀

    Since posting this I tried to dissect the function and get something along the lines of ‘if more than 1 image in this gallery, show controls div’, but just couldn’t make it happen. 🙁

    RYanWilliams,

    My guess is that those functions are actually echo’ing another function. You need the parent function.

    Some functions in WP work like that, and allow you to block echo’ing by adding an argument.

    hey RyanWilliams…

    if you ever resolved this, I’d be very interested in the answer! Struggling with the same thing right now. Thanks…

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Showin gallery prev/next links IF necessary’ is closed to new replies.