Answers.Body: <p>I found a solution:</p>
  <pre><code>{% include &quot;_private/partials/matrix&quot; with {blocks: entry.bodyContent.typeId(null).all()} %}
  </code></pre>
  <p>This fetches all Matrixobjects from any type.
  So it works now.</p>
  <p>But I don't undestand, why this is necessary.
  Maybe its because I used for my first project <a href="https://github.com/craftcms/starter-blog#:%7E:text=Craft%20CMS%20Blog%20Starter,with%20the%20Twig%20templating%20language." rel="nofollow noreferrer">this Blogstarter</a>.</p>
  <p>Maybe there are some relicts from craft2 inside.</p>
  <p>So I have the solution to my problem - but it would be nice to know why this was necessary.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-09-23T11:23:21.167Z
Answers.LastActivityDate: 2020-09-23T11:23:21.167Z
Answers.UserDisplayName: Slowwie
Answers.Body: <p>Without seeing the code of your template <code>_private/partials/matrix</code> it's not easy to help you.</p>
  <p>Maybe you need to check the block type first.
  I usually do that with a switch and have a different partial for each block.</p>
  <p>So your template <code>_private/partials/matrix</code> could look something like this:</p>
  <pre><code>{% for block in blocks %}
    {% switch block.type %}
      {% case &quot;richText&quot; %}
        {% include &quot;_private/partials/richtext&quot; %}
      {% case &quot;quote&quot; %}
        {% include &quot;_private/partials/qoute&quot; %}
      {% case &quot;image&quot; %}
        {% include &quot;_private/partials/image&quot; %}
      {% case &quot;embed&quot; %}
        {% include &quot;_private/partials/embed&quot; %}
      {% default %}
    {% endswitch %}
  {% endfor %}
  </code></pre>
  <p>The quote partial could look something like this</p>
  <pre><code>{# do something with block.style #}
  &lt;h4&gt;{{block.quote}}&lt;/h4&gt;
  &lt;h5&gt;{{block.attribution}}&lt;/h5&gt;
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-09-23T11:19:05.163Z
Answers.Text: Thank you for help. The problem is, there are just the Matrix objects with the type of 'richText' the rest ist not even fetched.
Answers.UserDisplayName: Slowwie
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-09-23T07:22:39.777Z
Answers.LastActivityDate: 2020-09-23T07:22:39.777Z
Answers.UserDisplayName: Steven Vandemoortele
Body: <p>I have some matrix fields defined:</p>
  <p><a href="https://i.sstatic.net/Lpxz3.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/Lpxz3.png" alt="enter image description here" /></a></p>
  <p>But when I use the matrix blocks inside of an entry - I don't get all blocks - just the richText ones.</p>
  <p>I tested it out - just the richtText Matrix blocks will be loaded when I do:</p>
  <pre><code>  {% include &quot;_private/partials/matrix&quot; with {blocks: entry.bodyContent.all()} %}
  </code></pre>
  <p>Is there something I am missing, or is this a bug?</p>
  <p>Would be great if someone could help.</p>
  
Tags: <templating><matrix><frontend><elementquery>
Title: Matrix fields don't load!
ThreadText: # Matrix fields don't load!
  
  (Asked by: username_0 on 2020-09-22)
  
  I have some matrix fields defined:
  
  [![enter image description here](https://i.sstatic.net/Lpxz3.png)](https://i.sstatic.net/Lpxz3.png)
  
  But when I use the matrix blocks inside of an entry - I don't get all blocks - just the richText ones.
  
  I tested it out - just the richtText Matrix blocks will be loaded when I do:
  
  ```
    {% include "_private/partials/matrix" with {blocks: entry.bodyContent.all()} %}
  
  ```
  
  Is there something I am missing, or is this a bug?
  
  Would be great if someone could help.
  
  **Tags:** templating, matrix, frontend, elementquery
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_0 on 2020-09-23. Score: 1
  
  I found a solution:
  
  ```
  {% include "_private/partials/matrix" with {blocks: entry.bodyContent.typeId(null).all()} %}
  
  ```
  
  This fetches all Matrixobjects from any type.
  So it works now.
  
  But I don't undestand, why this is necessary.
  Maybe its because I used for my first project [this Blogstarter](https://github.com/craftcms/starter-blog#:%7E:text=Craft%20CMS%20Blog%20Starter,with%20the%20Twig%20templating%20language.).
  
  Maybe there are some relicts from craft2 inside.
  
  So I have the solution to my problem - but it would be nice to know why this was necessary.
  
  
  ---
  
  ### Answer by username_1 on 2020-09-23. Score: 1
  
  Without seeing the code of your template `_private/partials/matrix` it's not easy to help you.
  
  Maybe you need to check the block type first.
  I usually do that with a switch and have a different partial for each block.
  
  So your template `_private/partials/matrix` could look something like this:
  
  ```
  {% for block in blocks %}
    {% switch block.type %}
      {% case "richText" %}
        {% include "_private/partials/richtext" %}
      {% case "quote" %}
        {% include "_private/partials/qoute" %}
      {% case "image" %}
        {% include "_private/partials/image" %}
      {% case "embed" %}
        {% include "_private/partials/embed" %}
      {% default %}
    {% endswitch %}
  {% endfor %}
  
  ```
  
  The quote partial could look something like this
  
  ```
  {# do something with block.style #}
  <h4>{{block.quote}}</h4>
  <h5>{{block.attribution}}</h5>
  
  ```
  
  > **Comments:**
  > **username_0**: Thank you for help. The problem is, there are just the Matrix objects with the type of 'richText' the rest ist not even fetched.  
  
  ---
  
  