2017-05-13 7 views
0

Timber/Wordpress에서 처음입니다.ACF 및 목재로 이미지를 가져올 수 없습니다.

목재와 함께 this plugin을 사용하려고하는데 이미지를 렌더링 할 수 없습니다.

난 단지 이미지의 식별자 받고 있어요 :

{% set images = post.get_field('gallery_images') %} // "47,48" 

을 나는 또한 시도 :

if (isset($post->hero_image) && strlen($post->hero_image)){ 
    $post->hero_image = new TimberImage($post->hero_image); 
} 

는 내가 모든 SRC를 얻을 수있는 방법 documentation

보았다 내 이미지?

답변

1

당신의 필드 gallery_images가 (ACF를 통해) 더 중첩 된 방법 또는 방법에 따라 다릅니다. 중첩되지 않은 경우 다음과 같이 작동해야합니다.

{% for image in post.get_field('gallery_images') %} 
    <img src="{{ TimberImage(image).src }}" alt="" /> 
{% endfor %}