TIMBER | Snippets
Include external SVG
{% set foo = img_dir ~ 'Buy.svg' %} // Define a variables {{ function('file_get_contents', Image(foo)) }} // Print the {{ options.logo_image | print_r }} // Print_r di array {{post.post_content|excerpt(30)}} //get excerpt (30 words ) {% if fn('is_front_page') %}{% else %}{% endif %} // If is homepage <img src="{{ fields.immagine_di_sfondo_blocco_banner.url }}" class="backgorund_image" title="{{ fields.immagine_di_sfondo_blocco_banner.title }}"> // Standard image ( from acf array ) <picture> <source srcset="{{ fields.immagine_di_sfondo_blocco_banner.url|towebp }}" type="image/webp"> <source srcset="{{ fields.immagine_di_sfondo_blocco_banner.url|tojpg }}" type="image/jpeg"> <img src="{{ fields.immagine_di_sfondo_blocco_banner.url|tojpg }}" alt="{{ fields.immagine_di_sfondo_blocco_banner.title }}"> </picture> // HTML5 Picture con fallback ( ( from acf array ) <picture class="img-{{myGal_firstimg}}" data-gallery="singola_gallery_{{myGal_singleslideTo}}"> <source srcset="{{ image.url|towebp|resize(160, 122) }}" type="image/webp"> <source srcset="{{ image.url|tojpg|resize(160, 122) }}" type="image/jpeg"> <img src="{{ image.url|tojpg|resize(160, 122) }}" alt="{{ image.title }}"> </picture> // HTML5 Picture con fallback ( from acf array ) with conversion to webp and resize {{ __('+ MORE DETAILS', 'bb-usa') }} // String with internalization