Skip to main content
Rollback to Revision 3
Source Link
Anna_MediaGirl
  • 2.5k
  • 2
  • 18
  • 45

How can I show next/previous paging that's limited by specific criteria?

I'm adding prev/next links to a detail page and can't get craft.entries to return the correct entries.

Specifically, I need craft.entries to return entries in the "leadership" section where the entry type (leadershipType) matches the current entry's entry type (leadershipType).Specifically, I need craft.entries to return entries in the "leadership" section where the leadershipType field matches the current entry's leadershipType value.

My code returns all entries instead of the ones specific to my field parameter.

{% set params = craft.entries.section('leadership').find({ leadershipType:entry.leadershipType }) %}

{% set prev = entry.getPrev(params) %}
{% set next= entry.getNext(params) %}?

{% if prev %}<a href="{{ prev.url }}">&lt;</a>{% endif %}
{% if next %}<a href="{{ next.url }}">&gt;</a>{% endif %}

How can I show next/previous paging limited by specific criteria?

I'm adding prev/next links to a detail page and can't get craft.entries to return the correct entries.

Specifically, I need craft.entries to return entries in the "leadership" section where the entry type (leadershipType) matches the current entry's entry type (leadershipType).

My code returns all entries instead of the ones specific to my field parameter.

{% set params = craft.entries.section('leadership').find({ leadershipType:entry.leadershipType }) %}

{% set prev = entry.getPrev(params) %}
{% set next= entry.getNext(params) %}?

{% if prev %}<a href="{{ prev.url }}">&lt;</a>{% endif %}
{% if next %}<a href="{{ next.url }}">&gt;</a>{% endif %}

How can I show next/previous paging that's limited by specific criteria?

I'm adding prev/next links to a detail page and can't get craft.entries to return the correct entries.

Specifically, I need craft.entries to return entries in the "leadership" section where the leadershipType field matches the current entry's leadershipType value.

My code returns all entries instead of the ones specific to my field parameter.

{% set params = craft.entries.section('leadership').find({ leadershipType:entry.leadershipType }) %}

{% set prev = entry.getPrev(params) %}
{% set next= entry.getNext(params) %}?

{% if prev %}<a href="{{ prev.url }}">&lt;</a>{% endif %}
{% if next %}<a href="{{ next.url }}">&gt;</a>{% endif %}
edited title
Link
Anna_MediaGirl
  • 2.5k
  • 2
  • 18
  • 45

How can I show next/previous paging that's limited by specific criteria?

made clear that this is about entry type specific pagination
Source Link
carlcs
  • 36.3k
  • 5
  • 63
  • 140

I'm adding prev/next links to a detail page and can't get craft.entries to return the correct entries.

Specifically, I need craft.entries to return entries in the "leadership" section where the leadershipType field matches the current entry's leadershipType value. Specifically, I need craft.entries to return entries in the "leadership" section where the entry type (leadershipType) matches the current entry's entry type (leadershipType).

My code returns all entries instead of the ones specific to my field parameter.

{% set params = craft.entries.section('leadership').find({ leadershipType:entry.leadershipType }) %}

{% set prev = entry.getPrev(params) %}
{% set next= entry.getNext(params) %}?

{% if prev %}<a href="{{ prev.url }}">&lt;</a>{% endif %}
{% if next %}<a href="{{ next.url }}">&gt;</a>{% endif %}

I'm adding prev/next links to a detail page and can't get craft.entries to return the correct entries.

Specifically, I need craft.entries to return entries in the "leadership" section where the leadershipType field matches the current entry's leadershipType value.

My code returns all entries instead of the ones specific to my field parameter.

{% set params = craft.entries.section('leadership').find({ leadershipType:entry.leadershipType }) %}

{% set prev = entry.getPrev(params) %}
{% set next= entry.getNext(params) %}?

{% if prev %}<a href="{{ prev.url }}">&lt;</a>{% endif %}
{% if next %}<a href="{{ next.url }}">&gt;</a>{% endif %}

I'm adding prev/next links to a detail page and can't get craft.entries to return the correct entries.

Specifically, I need craft.entries to return entries in the "leadership" section where the entry type (leadershipType) matches the current entry's entry type (leadershipType).

My code returns all entries instead of the ones specific to my field parameter.

{% set params = craft.entries.section('leadership').find({ leadershipType:entry.leadershipType }) %}

{% set prev = entry.getPrev(params) %}
{% set next= entry.getNext(params) %}?

{% if prev %}<a href="{{ prev.url }}">&lt;</a>{% endif %}
{% if next %}<a href="{{ next.url }}">&gt;</a>{% endif %}
Improved title and made it a question, made minor formatting improvements.
Source Link
Loading
deleted 1 character in body; edited title
Source Link
Anna_MediaGirl
  • 2.5k
  • 2
  • 18
  • 45
Loading
Source Link
Anna_MediaGirl
  • 2.5k
  • 2
  • 18
  • 45
Loading