I am setting three variables like so ...

{% set featureEntryIds = craft.entries({ section: 'blog', featurePost: 1, limit: 1 }).ids() %}

{% set articleClass = entry.id in featureEntryIds ? 'featured' %}`

{% set featuredPostLayout = entry.featuredPostLayout == 'subtleBar' or 'largeFeature' %}

Then I am trying to use a conditional to display posts where the featurePost lightswitch field is true


featuredPostLayout radio field is either subtleBar or largeFeature

{% if articleClass and featuredPostLayout %}

{% endif %}
  • There are a couple of obvious problems with your example code. First off, you're limiting the featured IDs query to one entry. I assume that's a mistake, as you're checking if an entry ID is "in" your list of featured IDs. Secondly, you're using a ternary conditional, without the "false" clause. Mar 16 '17 at 19:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.