0

Is it possible to pull an image from another entry? It seems like it would be simple. I've read a lot of posts and documentation, and feel like I'm close...

{% set entries = craft.entries.slug('homepage') %}

{% for image in entry.podcastItunesImage %}
    <itunes:image href="{{ siteUrl }}{{ image.getUrl}}" />
{% endfor %}

Basically, I'm trying to put an asset field on the Homepage for a iTunes image.

1 Answer 1

1

Yeah, I think you are close, you've just go your variables a bit mixed up. You set entries, but then reference entry and I think getUrl should be called as a function getUrl() as it's not a property (it might work that way, I've never tried tbh)

{% set entry = craft.entries.slug('homepage') %}

{% for image in entry.podcastItunesImage %}
 <itunes:image href="{{ image.first.getUrl() }}" />
{% endfor %}

Edit
Oh I don't think you need {{ siteUrl }} when you call getUrl()

4
  • You don't need .getUrl() either. {{ image.url }} would work aswell. Commented Sep 8, 2017 at 8:16
  • Oh nice, good tip! Commented Sep 8, 2017 at 8:18
  • That didn't work. The results are empty. I may end up creating a template file just for the podcast, so I can have a little more control over it. Commented Sep 8, 2017 at 17:24
  • You probably need to do {{ image.first.url }} because image fields can hold multiple images.
    – Youniteus
    Commented Sep 12, 2017 at 9:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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