<p>There is no <code>craft.entries.matrixes</code> variable available natively in Craft.</p>

<p>(<code>craft.entries</code> returns an <em>ElementCriteriaModel</em>, which does not have a <code>matrixes</code> property explicitly set.)</p>

<p>So, <code>craft.entries.matrixes</code> is actually looking for <code>ElementCriteriaModel-&gt;matrixes()</code>, which could <em>implicitly</em> exist if:</p>

<ul>
<li>You have a field called <em>matrixes</em>, <em>or</em></li>
<li>There's a plugin in the mix that is changing functionality</li>
</ul>

<p>You'll need a plugin to run these custom queries. Luckily Craft's <em>MatrixService</em> has plenty of methods that would be helpful.</p>

<p>Also, Low created a plugin (<a href="https://github.com/low/lowblocks">LowBlocks</a>) to do this sort of thing, which might fit your need, or at least offer a helpful starting point.</p>

CC BY-SA 3.0
2016-01-10T18:40:58.413Z
Low's plugin was exactly what i needed and still works great.  Thanks Michael!
Keith Mancuso
CC BY-SA 3.0
2016-01-05T18:04:38.367Z
2016-01-05T18:04:38.367Z
Michael Rog
<p>I found a way to do something like this</p>

<pre><code> {% set allBlocks =  craft.entries.matrixes %}
</code></pre>

<p>Which seems to return all the matrix blocks.. or at least I think it is?</p>

<p>But if try to filter down like:</p>

<pre><code>  {% set allBlocks =  craft.entries.matrixes.type('document') %}
</code></pre>

<p>I get nothing.</p>

<p>Any ideas how to get all the Matrix blocks by type or better still all the Matrix blocks in a particular field?</p>

<p>Would i need to setup a plugin for this?</p>

<matrix>
Is it possible to get all elements in a Matrix field by type or field name
# Is it possible to get all elements in a Matrix field by type or field name

(Asked by: username_0 on 2016-01-05)

I found a way to do something like this
 {% set allBlocks =  craft.entries.matrixes %}

Which seems to return all the matrix blocks.. or at least I think it is?
But if try to filter down like:
  {% set allBlocks =  craft.entries.matrixes.type('document') %}

I get nothing.
Any ideas how to get all the Matrix blocks by type or better still all the Matrix blocks in a particular field?
Would i need to setup a plugin for this?

**Tags:** matrix

---

## 1 answers

### Answer by username_1 on 2016-01-05. Score: 5 | Accepted answer

There is no `craft.entries.matrixes` variable available natively in Craft.

(`craft.entries` returns an *ElementCriteriaModel*, which does not have a `matrixes` property explicitly set.)

So, `craft.entries.matrixes` is actually looking for `ElementCriteriaModel->matrixes()`, which could *implicitly* exist if:

* You have a field called *matrixes*, *or*
* There's a plugin in the mix that is changing functionality

You'll need a plugin to run these custom queries. Luckily Craft's *MatrixService* has plenty of methods that would be helpful.

Also, Low created a plugin ([LowBlocks](https://github.com/low/lowblocks)) to do this sort of thing, which might fit your need, or at least offer a helpful starting point.

> **Comments:**
> **username_0**: Low's plugin was exactly what i needed and still works great.  Thanks Michael!  

---

