Skip to content

Instantly share code, notes, and snippets.

@kmgdevelopment
Created December 2, 2015 23:11
Show Gist options
  • Save kmgdevelopment/dfe6d793fb7210bfc565 to your computer and use it in GitHub Desktop.
Save kmgdevelopment/dfe6d793fb7210bfc565 to your computer and use it in GitHub Desktop.
Craft: Single-Image Asset Field
{% set bannerBg %}
{% for bgImg in entry.bannerBg %}
{{ bgImg.url }}
{% endfor %}
{% endset %}
@jeromecoupe
Copy link

You could use .first()

{% if entry.bannerBg %}
  {% set banner = entry.bannerBg.first() %}
  {% set bannerUrl = banner.url %}
{% endif %}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment