Forum
Swap previous/next links around
I'm using a list and detail page and creatiing previous next links
https://docs.grabaperch.com/perch/content/functions/how-do-i-link-prev-next/
All good so far apart from the template outputs the "previous" link after the "before" I'd like them the other way round "previous" first if it exists but can't figure how...
<a href="?s=<perch:content id="slug" type="slug" />">
<perch:if exists="is_prev">← Previous<perch:else />Next Event →</perch:if>
<perch:content id="eventname" type="text" suppress="true" />
</a>
I haven't tested this, but is it a case of switching the
perch_content_custom
for Previous to be before theperch_content_custom
call for the 'Next' on the page?That's what thought but swapping
perch_content_custom
makes the function fail.I fudged it for now by having the second
perch_content_custom
call a different template name of the same code and use CSS to float left right. It's not quite in the ideal source order. Hence asking the question.Hi, just running it in dev now...
Swapping the order of the
perch_custom_calls
is right, but when doing this we also need to unset theis_prev
variable before we call the final 'Next'perch_custom_content
callThanks for looking at this!
Hey, no problem. :) I'd not used it before and was interested to see how it works.
It's a neat solution to extend the functionality of list and detail pages.