<p>Those parameters are only meant to be used on entries within Structure sections. (Just updated the docs to make that more clear.)</p>

<p>If you want to get the next/previous entries within a Channel section, you can use <a href="http://buildwithcraft.com/docs/templating/entrymodel#getNext" rel="nofollow">EntryModel::getNext()</a> and <a href="http://buildwithcraft.com/docs/templating/entrymodel#getPrev" rel="nofollow">getPrev()</a>.</p>

<p>There’s a bit of a trick with those functions though, because “next” and “previous” are ambiguous. (Only consider the entries in a specific channel? Or just the ones with a specific custom field value? etc.) So you need to pass element criteria params into those functions to establish what the full order of entries is.</p>

<p>In your case, sounds like you want the next/previous entries within your <code>news</code> section. I’ll assume you want those entries to be listed by Post Date in descending order (so the latest stories are shown first), and the “Next” entry in this case would be whatever story came before the current one; and the “Previous” story would be whatever came later. (If my assumption is wrong, just change <code>desc</code> to <code>asc</code> in the <code>order</code> param.)</p>

<pre><code>{% set newsCriteria = craft.entries.section('news').order('postDate desc') %}
{% set prevEntry = entry.getPrev(newsCriteria) %}
{% set nextEntry = entry.getNext(newsCriteria) %}

{% if prevEntry %}
  &lt;a href="{{ prevEntry.url }}" class="prev"&gt;{{ prevEntry.title }}&lt;/a&gt;
{% endif %}

{% if nextEntry %}
  &lt;a href="{{ nextEntry.url }}" class="next"&gt;{{ nextEntry.title }}&lt;/a&gt;
{% endif %}
</code></pre>

CC BY-SA 3.0
2015-10-01T11:44:41.863Z
2015-10-01T11:50:56.450Z
2015-10-01T11:50:56.450Z
Brandon Kelly
<p>Super simple problem. I'm on a news item page (not a paginated overview page) and want to show a link to the next news item in the Channel; So I can't understand why this is outputting nothing at all:</p>

<pre><code>{{ craft.entries.section('news').nextSiblingOf(entry).title }}
</code></pre>

<p>I can't seem to get either of the SiblingOf properties to do anything. What simple mistake am I making?</p>

<p>(I have also tried the following to no avail...)</p>

<pre><code>{{ craft.entries.section('news').nextSiblingOf(entry).first().title }}
</code></pre>

<pagination>
Using prevSiblingOf and nextSiblingOf
# Using prevSiblingOf and nextSiblingOf

(Asked by: username_0 on 2015-10-01)

Super simple problem. I'm on a news item page (not a paginated overview page) and want to show a link to the next news item in the Channel; So I can't understand why this is outputting nothing at all:
{{ craft.entries.section('news').nextSiblingOf(entry).title }}

I can't seem to get either of the SiblingOf properties to do anything. What simple mistake am I making?
(I have also tried the following to no avail...)
{{ craft.entries.section('news').nextSiblingOf(entry).first().title }}

**Tags:** pagination


---

## 1 answers

### Answer by username_1 on 2015-10-01. Score: 4 | Accepted answer

Those parameters are only meant to be used on entries within Structure sections. (Just updated the docs to make that more clear.)
If you want to get the next/previous entries within a Channel section, you can use EntryModel::getNext() and getPrev().
There’s a bit of a trick with those functions though, because “next” and “previous” are ambiguous. (Only consider the entries in a specific channel? Or just the ones with a specific custom field value? etc.) So you need to pass element criteria params into those functions to establish what the full order of entries is.
In your case, sounds like you want the next/previous entries within your news section. I’ll assume you want those entries to be listed by Post Date in descending order (so the latest stories are shown first), and the “Next” entry in this case would be whatever story came before the current one; and the “Previous” story would be whatever came later. (If my assumption is wrong, just change desc to asc in the order param.)
{% set newsCriteria = craft.entries.section('news').order('postDate desc') %}
{% set prevEntry = entry.getPrev(newsCriteria) %}
{% set nextEntry = entry.getNext(newsCriteria) %}

{% if prevEntry %}
  {{ prevEntry.title }}
{% endif %}

{% if nextEntry %}
  {{ nextEntry.title }}
{% endif %}


---

