1

My site is built on a single structure section called "pages". It includes 4 entryTypes.

One of the entryTypes is called "contact" and includes a MatrixBlock that displays fine on the contact page.

I'd like to make use of those entries (from the Matrix Block) in the site's footer (on all pages). Here is where I started:

{% for block in entry.MatrixFieldHandle.type('MatrixBlockHandle') %}
{{ block.title }} etc...
{% endfor %}

This only works on the contact page itself. How can I display a Matrix Field elsewhere than on its own page?

1 Answer 1

3

First you need to get the correct entry. Based on what you write, you can get it in any template by doing:

{% set contactPageEntry = craft.entries.section('pages').type('contact').first() %}

Then you should be able to loop over your matrix field like this:

{% for block in contactPageEntry.MatrixFieldHandle.type('MatrixBlockHandle') %}
    {{ block.title }} etc...
{% endfor %}
0

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.