I would like to link the next and previous item within my exhibit-builder/exhibits/item.php template. Currently I'm using link_to_previous_item(); and link_to_next_item();. Those work well, except they go to the next/previous items within the items/show.php template (instead of within the Exhibit Builder template).
Any easy way to do this?
To clarify, it's an issue of URL going to the parent public theme's items/show.php instead of exhibit-builder/exhibits/item.php.
You should be able to do this with the exhibit_builder_link_to_exhibit_item
, get_previous_item
and get_next_item
functions.
An example for "next item:"
if ($next = get_next_item()):
echo exhibit_builder_link_to_exhibit_item('Next Item', array(), $next);
endif;
That works great! Thank you!
I'd appreciate any help,
I have been trying to input the functions above into my ExhibitBuilder/Views/public/Exhibits/Item.php file, but I cannot get this to work. I want the items in the exhibit to be navigable with the Next and Previous links in the order they are in the exhibit, not the entire collection of items I have.
Is this not correct?
<?php if ($next = get_next_item()): ?>
<?php echo exhibit_builder_link_to_exhibit_item('Next Item', array(), $next); <?php endif; ?>
<?php if ($previous = get_previous_item()): ?>
<?php echo exhibit_builder_link_to_exhibit_item('Previous Item', array(), $previous); <?php endif; ?>
All the posted code does is make sure you're still on the Exhibit Builder's templates. It doesn't actually affect what the next and previous items will be; they'll still be site-wide.
Ah. Thanks for clarifying.
So is there a creative way to ensure that when a user accesses an item in an exhibit, the next-previous buttons only cycle through exhibit items?