Skip to content

Instantly share code, notes, and snippets.

@coryetzkorn
Last active August 5, 2022 19:16
Show Gist options
  • Save coryetzkorn/c0bb2192d0c7dc9ddc3af21226afe4e6 to your computer and use it in GitHub Desktop.
Save coryetzkorn/c0bb2192d0c7dc9ddc3af21226afe4e6 to your computer and use it in GitHub Desktop.
Craft CMS Prev / Next Entries
{% set prevSibling = craft.entries().prevSiblingOf(entry).one() %}
{% set nextSibling = craft.entries().nextSiblingOf(entry).one() %}
{% set prevEntry = prevSibling ? prevSibling : craft.entries().section('work').inReverse().one() %}
{% set nextEntry = nextSibling ? nextSibling : craft.entries().section('work').one() %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment