I would like to loop through entries in a channel but only the ones for a specific entry type. Is this Possible?

I'm using the free version of craft on a test site, I have used the channel for my pages but also want to set up a blog. I have set up a blogPost entry type, is there a way to target this in a loop?

{% set entries = craft.entries.section('pages').type('blogPost') %}

{% for entry in entries %}
   {{ entry.title }}
{% endfor %}

Is what I have cobbled together... any pointers on improvements would be welcome.

| improve this answer | |
  • 2
    That's exactly how to do it! – Brad Bell Jul 5 '14 at 13:32
  • Cheers Brad much appreciated. – bobbyballbags Jul 5 '14 at 19:43

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.