how can I conditionally output rows of an matrix, if there are any? Eg:

{if matrixfield}
    <h2>Also check</h2>
        <a href="{url_title}">{title}</a><br />


2 Answers 2


Yep, just check to see if the matrix field total_rows are greater than 0

{if my_matrix_field:total_rows > 0}
    Matrix field has rows
  • This should be marked as the answer, IMHO. Oct 21, 2013 at 20:38

I dont have enough rep to make a comment.

So, I am not sure what you are looking for. The code below is an example how to work with conditionals for Matrix.


   {if no_results}
       No rows available

   {if '{row_count}' == '1'}
       <a href="{url_title}">{title} - First row</a>

  <a href="{url_title}">{title}</a>

   {if '{row_count}' == '{total_rows}'}
        <a href="{url_title}">{title} - Last row</a>

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.