How to confine previous and next item page links to that exhibit

Used the code below to create previous and next links on the item pages in a particular exhibit. On the first item the previous link is trying to access an item that is sequentially before it ... but it is in a different exhibit. What to do?

Thank you so much, Lyn

I think that in order to employ the method used in the related forum post you shared, you'd need to edit/create the following file for your theme:


Do you have this template file in your theme directory?

Yes I do, and I using a greatly customized version of your theme. Can you tell me more?


Also ... I've added the script and it works ... it just doesn't operate within the confines of the exhibit ... it tries to access the next (or previous) item even if it doesn't belong to the current exhibit.


Ah, I see.

So one thing you could do is use url query strings and $_GET to send and read exhibit navigation info between item pages, though it will require some work and editing not just the exhibit/item.php but also exhibit/show.php etc.

Say, the first link (i.e. index=0) for an exhibit with the id of 1, goes to an item with the id of 2. You could build the first link to include the exhibit id and the index number for the item, like Then on the exhibit/item.php template, you'd need to parse that info via something like:

if ( (isset($_GET['exhibit'])) && (isset($_GET['index'])) ){


     // Use the $exhibit var to retrieve info about the exhibit
     // Retrieve all the items in the exhibit in order from 0
     // Using $index, figure out which item is previous, next, etc.

With that info, you could reset the next and previous links.

I'm not sure offhand the best way to do this with the ExhibitBuilder, but I did something similar with a different plugin (TourBuilder). It may be useful to browse that function:

OK. Next week will share this my colleague who will be doing the scripts and get back to you. This is the last piece we need. Thanks. Lyn