Check length of textfield in header file Some links in the menu should only be shown if the textfield is not empty. For example:

{% if craft.entries.section('aboutus').textField|length == 0 %} style="display: none;" {% endif %}.


But craft.entries.section('aboutus').textField|length always returns 1. I also tried is empty. 

So, how I get the real length of this textfield? 

And I have the same problem with a matrix. How can I check if the Matrix field has any blocks?
This should do it for a text field:

craft.entries.section('aboutus').textField(':empty:')|length


To see if a Matrix field has any blocks, it's not as pretty.  There's probably a better way, but it's all I can think of at the moment:

{% set entries = craft.entries.section('news') %}

{% set validEntries = [] %}

{% for entry in entries %}
    {% if entry.matrixField|length %}
        {% set validEntries = valid|merge([entry]) %}
    {% endif %}
{% endfor %}


validEntries is now an array of entries that have at least one block.