Browsing through entries - Twig, Craft CMS

{% set singleEntry = craft.entries.section('tentoonstellingenIndex').first() %} {# Set parameters for prev/next elements list #} {% set params = craft.entries.section('tentoonstellingen').order('startdatum desc') %} {# Get the prev/next elements #} {% set prevEntry = entry.getPrev(params) %} {% set nextEntry = entry.getNext(params) %} {# And make sure to only output the links if the element exists #} {% if prevEntry %}<li><a href="{{ prevEntry.url }}" title="{{ prevEntry.title }}"><i class="fa fa-angle-left"></i></a></li>{% endif %} <li><a href="{{ singleEntry.getUrl() }}"><i class="fa fa-th"></i></a></li> {% if nextEntry %}<li><a href="{{ nextEntry.url }}" title="{{ nextEntry.title }}"><i class="fa fa-angle-right"></i></a></li>{% endif %}

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.