2

I would like to retrieve related entries that have the same tags, not just one similar tag, but all of them.

At the moment I do something like:

{% set tags = entry.tagActualite %}
{% set relatedEntries = craft.entries.relatedTo(tags).id('not ' ~ entry.id).limit(5).find() %}

{% if relatedEntries | length %}
    {% for entry in relatedEntries %}
        do stuff
    {% endfor %}
{% endif %}

But it retrieves any entry with at least one similar tag.

How would i check against ALL tags ?

1 Answer 1

2

I believe you'll need to look at using the following syntax:

craft.entries.relatedTo('and', { targetElement: tags })

You might have some luck using the Similar plugin.

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.