2

Is there a way to be able to use entry.getNext(params) to return back to the first entry when you're viewing the last entry in the parameters?

With the result of looping/cycling through all entries and returning to the original.

1 Answer 1

1

If there isn't a "next" sibling, entry.getNext() returns null – in which case you can use Twig's default filter to set an alternative value (i.e. your first entry).

Untested, but something like this should work:

{% set nextEntry = entry.getNext|craft.entries.section('mySectionHandle').first() %}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.