Retrieving Entries With a Lightswitch Field Set to “Yes”

Problem

You want to retrieve only those entries with a lightswitch field set to “Yes”.

Solution

Let’s assume you have a lightswitch field with the handle voteRusso, and you want to retrieve only those entries with the field set to “Yes”.

Here’s how to do that:

{% set ayes = craft.entries.section('congress').voteRusso('1') %}