Is there a way to check if any fields in a global set have content? I have a global set called socialNetworkContent.

Is there a way to setup a conditional to check whether any of the fields within this set have content?

So the section wouldn't display if all the fields were blank.

Something along these lines:

{% if socialNetworkContent|length %}
&lt;section&gt;
&lt;div class="social"&gt;
    &lt;h1&gt;Follow Us&lt;/h1&gt;
    &lt;ul&gt;
            {% if socialNetworkContent.branchFacebookProfile|length %}&lt;li&gt;&lt;a href="{{ socialNetworkContent.branchFacebookProfile }}"&gt;&lt;i class="fa fa-facebook fa-2x"&gt;&lt;/i&gt;&lt;/a&gt;&lt;/li&gt;{% endif %}
            {% if socialNetworkContent.branchTwitterAccount|length %}&lt;li&gt;&lt;a href="{{ socialNetworkContent.branchTwitterAccount }}"&gt;&lt;i class="fa fa-twitter fa-2x"&gt;&lt;/i&gt;&lt;/a&gt;&lt;/li&gt;{% endif %}
            {% if socialNetworkContent.branchLinkedInAccount|length %}&lt;li&gt;&lt;a href="{{ socialNetworkContent.branchLinkedInAccount }}"&gt;&lt;i class="fa fa-linkedin fa-2x"&gt;&lt;/i&gt;&lt;/a&gt;&lt;/li&gt;{% endif %}
            {% if socialNetworkContent.branchGooglePlusAccount|length %}&lt;li&gt;&lt;a href="{{ socialNetworkContent.branchGooglePlusAccount }}"&gt;&lt;i class="fa fa-google-plus fa-2x"&gt;&lt;/i&gt;&lt;/a&gt;&lt;/li&gt;{% endif %}
            {% if socialNetworkContent.branchInstagramAccount|length %}&lt;li&gt;&lt;a href="{{ socialNetworkContent.branchInstagramAccount }}"&gt;&lt;i class="fa fa-instagram fa-2x"&gt;&lt;/i&gt;&lt;/a&gt;&lt;/li&gt;{% endif %}
            {% if socialNetworkContent.branchYoutubeAccount|length %}&lt;li&gt;&lt;a href="{{ socialNetworkContent.branchYoutubeAccount }}"&gt;&lt;i class="fa fa-youtube fa-2x"&gt;&lt;/i&gt;&lt;/a&gt;&lt;/li&gt;{% endif %}
    &lt;/ul&gt;
&lt;/div&gt;
&lt;/section&gt;
{% endif %}
It's not exactly "quick", you'll have to do something like this:

{% if socialNetworkContent.branchFacebookProfile|length 
       or socialNetworkContent.branchTwitterAccount|length
       or socialNetworkContent.branchLinkedInAccount|length
       ...
%}


Which is probably exactly what you're trying to avoid.

If you want to just make it a little easier to read, you can do something like this:

{% set x = socialNetworkContent %}

{% if x.branchFacebookProfile|length 
       or x.branchTwitterAccount|length
       or x.branchLinkedInAccount|length
       ...
%}


The hurdle that you're dealing with is the fact that the socialNetworkContent object contains many other attributes besides just your custom field names. So there's not really any efficient way to "loop through" your custom fields without dealing with a bunch of extra junk.

Of course, you could build a plugin to create a simple boolean variable, but that sounds like overkill for this situation.