Working on my first craft site and I'm setting up a thankyou template for after a form submission, but am getting an error when calling the contact entry (it's a single).

I've tried several code variations with no luck. This is my current template

 # Contact Thank You template
 # ---------------

{% extends "_layout" %}

{# pass body id to layout template #}
{% set bodyId = 'contact' %}

    {% set entries = craft.entries.section('contact').id(5).find() %}
    {% for entry in entries %}

        {# Top Images/Slider Content Here #}
        {% block headImage %}
        {{ entry.title }}

        {% endblock %}

    {% endfor %}{# end contact entry for loop #}

Please advise.

  • What's the block headImage doing? – Steven Grant Jul 20 '16 at 15:54
  • That block is in the layout template and is usually replaced with an image from the entry. I've just removed the image for testing purposes and am tryiing to pull in the title – CreateSean Jul 20 '16 at 15:56

I'd simplify the entry like so

   {% set entry = craft.entries.id(5) %}
   {{ entry.title }}
  • This made me realize I had the for loop outside of the block. As soon as I moved the loop inside the block it worked. I'm such a noob – CreateSean Jul 20 '16 at 15:57

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.