Looping Entries Based on Field State I'm pretty new to Twig and I know the level here is far above my question, but thank you in advance...

I'm designing a site with sponsor logos on the homepage, each sponsor is an entry in a channel of sponsors. I have a lightswitch field on the entry page called 'showOnHome'.  I've tried "if" statements and conditionals in the loop, but have only got to where it shows the first entry and breaks the loop.

The following works to get all of the entries, 

&lt;ul&gt;
    {% for entry in craft.entries.section('sponsors') %}
        {% for image in entry.sponsorlogo %}

            &lt;li&gt;&lt;a href="{{ entry.getUrl }}"&gt;&lt;img src="{{ image.getUrl() }}" alt="{{ image.title }}"&lt;/a&gt;&lt;/li&gt;

        {% endfor %}
    {% endfor %}
&lt;/ul&gt;


How do I only get entries where showOnHome == '1'?

Thank you in advance for helping the rookie.
{% for entry in craft.entries.section('sponsors').showOnHome('1') %}

The .showOnHome('1') restricts your query to ones with the lightswitch on.

If you wanted only the ones with the lightswitch off, you would use .showOnHome('not 1')