/ Published in: PHP
For use within The Loop, in your portfolio item page template.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php // http://tylersticka.com/2009/09/wcpdx09/ // Retrieve custom meta for this item $fields = get_post_custom(); // If the gallery key exists, let's show some gallery functionality // Split the comma-separated gallery meta value into an array // Grab the current WordPress page and use it as the current // gallery item (defaults to 1) $current = ($paged == '') ? 1 : $paged; // Grab the current image from the array $image = $images[$current-1]; // Display the current gallery image with intelligent alt text ?> <div id="gallery"> <?php // Only show "next" and "back" controls if there's more // than one gallery item ?> <ul> <?php if ($current > 1) { ?><li class="prev"><a href="<?php the_permalink() ?>page/<?php echo $current-1; ?>">Previous Image</a></li><?php } ?> <?php if ($current < count($images)) { ?><li class="next"><a href="<?php the_permalink() ?>page/<?php echo $current+1; ?>">Next Image</a></li><?php } ?> </ul> <?php } ?> </div> <?php } ?>
URL: http://tylersticka.com/2009/09/wcpdx09/