Answers.Body: <p>You can access a category's fields exactly like you
  access an entry's fields.</p>
  
  <pre><code>{{ category.myLightswitch }}
  </code></pre>
  
  <p>So this should do it for your categories loop:</p>
  
  <pre><code>{% for entry in entries %}
      {% for category in entry.myCategoriesField %}
  
          {{ category }}
  
          {% if category.myLightswitch %}
              EXTRA
          {% endif %}
  
      {% endfor %}
  {% endfor %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-10-22T16:02:40.723Z
Answers.LastActivityDate: 2015-10-22T16:02:40.723Z
Answers.UserDisplayName: carlcs
Body: <p>I have set up a custom field for a category group. How do I get the value of this field in a loop that goes through entries? Each category in the group could have this field's value set as true or false (light switch). I.e. I need to see what category is related to the current entry and then look up the value of this field - there is some html I want to show only if the value is true.</p>
  
Tags: <categories>
Title: Fields associated with a category group
ThreadText: # Fields associated with a category group
  
  (Asked by: username_0 on 2015-10-22)
  
  I have set up a custom field for a category group. How do I get the value of this field in a loop that goes through entries? Each category in the group could have this field's value set as true or false (light switch). I.e. I need to see what category is related to the current entry and then look up the value of this field - there is some html I want to show only if the value is true.
  
  **Tags:** categories
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2015-10-22. Score: 2 | Accepted answer
  
  You can access a category's fields exactly like you
  access an entry's fields.
  
  ```
  {{ category.myLightswitch }}
  
  ```
  
  So this should do it for your categories loop:
  
  ```
  {% for entry in entries %}
      {% for category in entry.myCategoriesField %}
  
          {{ category }}
  
          {% if category.myLightswitch %}
              EXTRA
          {% endif %}
  
      {% endfor %}
  {% endfor %}
  
  ```
  
  
  ---
  
  