1

I have a number of 'blog' channel entries related to various 'fayre' entries I want to display all the blog entries related to the fayre entry page they are related to (Entry field is 'fayreBlog'), but not ones which are not related to that entry, so far I can only display only one blog entry and not more (even though there are more related to the entry I am relating to) not sure where my code is wrong? it resides in the fayres _entry.twig template:

{% set relatedBlogs = craft.entries.section('blog').relatedTo(entry).all() %}

{% for post in relatedBlogs %}
    <p>{{ post.title }} </p>
{% endfor %}
1

Argh! this code works! I had duplicate entries and looking at the wrong entry! User erroooor!

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.