Answers.Body: <p>No, you still have to set the parameters by your own:</p>
  
  <pre><code>{# Get this entry's entry type #}
  {% set type = entry.getType() %}
  
  {# Set parameters for prev/next elements list #}
  {% set params = craft.entries.section('blog').type(type) %}
  
  {# 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 %}&lt;a href="{{ prevEntry.url }}"&gt;Previous&lt;/a&gt;{% endif %}
  {% if nextEntry %}&lt;a href="{{ nextEntry.url }}"&gt;Next&lt;/a&gt;{% endif %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-10-30T16:58:33.067Z
Answers.LastActivityDate: 2014-10-30T16:58:33.067Z
Answers.UserDisplayName: carlcs
Body: <p>As an extension of this question
  <a href="https://craftcms.stackexchange.com/questions/52/how-to-link-to-previous-next-entries-in-a-section">How to link to previous/next entries in a section?</a></p>
  
  <p>If my page is set to automatically provide a <code>entry</code> var in my template.
  And I can simply access a field like this</p>
  
  <pre><code>entry.title
  </code></pre>
  
  <p>Which means I don't need to do something like this</p>
  
  <pre><code>{% set entry = craft.entries.section('blog').first() %}
  </code></pre>
  
  <p>If I want to get the next entry and previous entry based on this entry's entry type. Is it possible?</p>
  
Tags: <templating><entry><entry-type>
Title: Get next entry based on entry type
ThreadText: # Get next entry based on entry type
  
  (Asked by: username_0 on 2014-10-30)
  
  As an extension of this question
  [How to link to previous/next entries in a section?](https://craftcms.stackexchange.com/questions/52/how-to-link-to-previous-next-entries-in-a-section)
  
  If my page is set to automatically provide a `entry` var in my template.
  And I can simply access a field like this
  
  ```
  entry.title
  
  ```
  
  Which means I don't need to do something like this
  
  ```
  {% set entry = craft.entries.section('blog').first() %}
  
  ```
  
  If I want to get the next entry and previous entry based on this entry's entry type. Is it possible?
  
  **Tags:** templating, entry, entry-type
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2014-10-30. Score: 7 | Accepted answer
  
  No, you still have to set the parameters by your own:
  
  ```
  {# Get this entry's entry type #}
  {% set type = entry.getType() %}
  
  {# Set parameters for prev/next elements list #}
  {% set params = craft.entries.section('blog').type(type) %}
  
  {# 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 %}<a href="{{ prevEntry.url }}">Previous</a>{% endif %}
  {% if nextEntry %}<a href="{{ nextEntry.url }}">Next</a>{% endif %}
  
  ```
  
  
  ---
  
  