3

Maybe I'm going mad here, but I can't figure out how to get all entries which are in a certain category. Following the syntax laid out here: http://buildwithcraft.com/help/entries-related-to-category you'd think something like this would work, but I get nothing:
{% for entry in craft.entries.relatedTo('Naming') %}

'Naming' is my category, and I have several case study entries with that category attributed. I also tried adding more params, like restricting it to just the case study section:
{% for entry in craft.entries.section('ourWork').relatedTo('Naming') %}

This would be outside the category page or related case study page btw, ie on the homepage.

1 Answer 1

5

Found an answer to this here: https://craftcms.stackexchange.com/a/4132/3890

The important thing to note is when you're using relatedTo you're not passing a slug, you're passing a whole object. So just .relatedTo('category-name') won't work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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