I want to display blog entries within the related entry template linked together with 'entries fields':
-- Entrysection Bla
Blog
-- Blog entry 1 (Linked to Entrysection Bla via 'entries fields')
-- Blog entry 2 (no relations)
Now I want to display Blog entry 1
in Entrysection Bla
{% for entry in craft.entries.section('bla') %}
{% for entries_fields in craft.entries.section('blog'){# related to ??? #} %}
<a href="{{ entries_fields.url }}">{{ entries_fields.title }}</a>
{% endfor %}
{% endfor %}
I figured it has to be done with relatedTo
but I cant get it done. How do I have to write this?
-- Edit:
Now my code on Entrysection Bla
looks like this:
{% set entries_fields = craft.entries.section('blog').relatedTo({
sourceElement: entry,
field: 'blogSaisonKategorie'
}) %}
{% for xy in entries_fields %}
<a href="{{ xy.url }}">{{ xy.title }}</a>
{% endfor %}
That prints out nothing. No error is displayed as well.
entry
coming from? Are you still doing the for loop around this code? Or are you relying onentry
to be populated by Craft in how you're pointing to this template? – Peter Tell Dec 19 '14 at 17:12sourceElement
totargetElement
now its bringing up all blog entries without filtering (It even shows the inactive blog entries). At least thats something. Yes I'm looping around the code. I guess my error has something to do withtargetElement: entry,
. It somehow does't listen to the fieldhandle of theentries-fields
fiedltype. – KSPR Dec 26 '14 at 14:49