19

How can I exclude the current entry when I've structured my syntax like this?

{% set entries = craft.entries({
  section:        'blog',
  order:          'postDate',
  limit:          5,
}) %}
30
{% set entries = craft.entries({
  section:        'blog',
  order:          'postDate',
  limit:          5,
  id:             'not ' ~ entry.id
}) %}

or

{% set entries = craft.entries({
  section:        'blog',
  order:          'postDate',
  limit:          5,
}).id('not ' ~ entry.id) %}
  • Thanks for the reply. I tried that but then I get the error: "Variable "entry" does not exist". – Niall Thompson Jul 19 '14 at 18:50
  • What is the current entry that you are trying to exclude? – Marion Newlevant Jul 19 '14 at 18:52
  • Ah, I understand. I'm editing the wrong template :( – Niall Thompson Jul 19 '14 at 18:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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