Skip to content

Instantly share code, notes, and snippets.

@brandonkelly
Created June 6, 2013 16:42
Show Gist options
  • Save brandonkelly/5722967 to your computer and use it in GitHub Desktop.
Save brandonkelly/5722967 to your computer and use it in GitHub Desktop.
New getNext() / getPrev() support coming to all elements in Craft 1.1
{% set criteria = {section: 'cocktails', order: 'title'} %}
{% set prev = entry.getPrev(criteria) %}
{% set next = entry.getNext(criteria) %}
{% if prev or next %}
<div class="pane">
{% if prev %}
<p>Previous: <a href="{{ prev.url }}">{{ prev.title }}</a></p>
{% endif %}
{% if next %}
<p>Next: <a href="{{ next.url }}">{{ next.title }}</a></p>
{% endif %}
</div>
{% endif %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment