Skip to content

Instantly share code, notes, and snippets.

@insaurabh
Created February 28, 2019 09:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save insaurabh/db14ef067033b78837fc4e6fc351c1d2 to your computer and use it in GitHub Desktop.
Save insaurabh/db14ef067033b78837fc4e6fc351c1d2 to your computer and use it in GitHub Desktop.
Get entries based on custom field in twig template
{% set sponsoredentries = craft.entries({ id: 'not ' ~ entry.id })
.section(["articles", "sneakers"])
.lightswitchFieldHandle(1)
.limit(10)
%}
{% for item in sponsoredentries %}
<div class="content">
<p>{{ item.title }}</p>
</div>
{% endfor %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment