I have a field isotope. It's a dropdown field with a single word text input. Only one value (out of 6) can be assigned to an entry. It is not a tag. It is not a category.

I want to create a button for each value within the isotope field.

{% for button in entry.isotope %}  

    <button class="button" data-filter="{{button.title}}">{{button.title}}</button>

{% endear %}

This is wrong and generates the error Variable "entry" does not exist. I know this is basic, but I am obviously missing something.

  • Where are you trying to output this? The error indicates you're not on an entry template or have not set "entry". Sep 6 '16 at 16:03

Variable "entry" does not exist

This error is being caused by the first line of your code:

... in entry.isotope %}

You are either using this template code on an element that isn't an entry or haven't defined a variable called entry anywhere.

So we can help you more, what type of element is this field being used on?

  • For entries under the channel section posts.
    – Hellyar
    Sep 6 '16 at 16:52
  • ...so, how do I point to a field called/ with the handle isotope that appears in the entries section posts
    – Hellyar
    Sep 6 '16 at 18:13
  • 1
    The votes are from others here who feel that Jamie is being helpful with his answer. His answer is entirely correct. You are getting the error because either a) you are not on a template page, or b) you are not calling entry in any way. That is why you are getting the error. You still have not indicated where and how you are trying to output this and he's giving you the best push forward to solving this with what you've supplied. Sep 6 '16 at 19:07
  • Have you assigned the field called isotope to the section "Posts"? Under Settings >> Sections >> Edit Entry Type Sep 6 '16 at 19:19
  • Yes, isotope is assigned to the entry type associated with posts. And I can successfully pull the assigned value for a given entry to use it as a class name in my HTML.
    – Hellyar
    Sep 7 '16 at 13:52

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.