<p>You could try looking for an empty string: <code>mdFeatured('')</code> or prefix 1 or true with not: <code>mdFeatured('not 1')</code>.</p>

CC BY-SA 3.0
2015-05-01T14:34:36.673Z
Thank you, that worked. Still feels odd that "false" by itself does not work though.
Nicholas LeBlanc
CC BY-SA 4.0
2019-07-14T03:00:26.943Z
This doesn't work in Craft 3. I've tried everything I can think of and still nothing. ```
{% set entries = craft.entries.section('pages').hideFromNavigation('not 1') %}
'0'
false
``` No idea where to go from here.
kinoli
CC BY-SA 3.0
2015-04-30T23:00:32.477Z
2015-04-30T23:00:32.477Z
carlcs
<p>I have a field (mdFeatured) set up as a lightswitch field type. I am trying to retrieve both featured and non-featured entries:</p>

<pre><code>{% set featuredEntries = craft.entries.section('merchantDirectory').mdFeatured(true).relatedTo(category).find() %}
{% set normalEntries = craft.entries.section('merchantDirectory').mdFeatured(false).relatedTo(category).find() %}
</code></pre>

<p>The featured entries are being retrieved properly, but the normal entries are returning both featured entries and normal entries mixed together. Any possibly know why this is not working? I tried replacing "true" and "false" with "1" and "0" but that did not seem to work either.</p>

<p>Thanks!</p>

<templating>
Querying by lightswitch field type in template
# Querying by lightswitch field type in template

(Asked by: username_0 on 2015-04-30)

I have a field (mdFeatured) set up as a lightswitch field type. I am trying to retrieve both featured and non-featured entries:
{% set featuredEntries = craft.entries.section('merchantDirectory').mdFeatured(true).relatedTo(category).find() %}
{% set normalEntries = craft.entries.section('merchantDirectory').mdFeatured(false).relatedTo(category).find() %}

The featured entries are being retrieved properly, but the normal entries are returning both featured entries and normal entries mixed together. Any possibly know why this is not working? I tried replacing "true" and "false" with "1" and "0" but that did not seem to work either.
Thanks!

**Tags:** templating


---

## 1 answers

### Answer by username_1 on 2015-04-30. Score: 4 | Accepted answer

You could try looking for an empty string: `mdFeatured('')` or prefix 1 or true with not: `mdFeatured('not 1')`.

> **Comments:**
> **username_0**: Thank you, that worked. Still feels odd that "false" by itself does not work though.  
> **username_2**: This doesn't work in Craft 3. I've tried everything I can think of and still nothing. ``` {% set entries = craft.entries.section('pages').hideFromNavigation('not 1') %} '0' false ``` No idea where to go from here.  

---

