How to insert a gallery to the product on the twig?

Good morning
Have ACF type: gallery (galery), have a page template in twig.
How to get celerey through twig, is there any shortcodes? and how them to register?
April 3rd 20 at 17:26
2 answers
April 3rd 20 at 17:28
Solution
Twigg is a surrogate (as there is for the fashion - syntactic sugar :) ). As less, jsx, pug... They help to speed up - but without proper tools - just a mess of text.
Convert to the normal view and implement it native.
tvig is designed to go native, nothing is implemented, only the html markup - Elyse84 commented on April 3rd 20 at 17:31
@Elyse84, and php is designed to used si
Continue? - charles commented on April 3rd 20 at 17:34
@charles,
No, that's a dead-end development, back to the previous comment back.
Template is a template and is used to display information, there is no room for PHP code is also linked to output all the same information. But, unfortunately, these programmers are very few in the world, and if you give to write in template to write php code, I assure you 100% he will be there. And that's when the template starts, the database queries to perform the calculations (some percent of likes, tags, etc.), and if you collect all the sites on wordpress can not do such a find, to debug the sites or to do further customisation is very difficult.
And if people decided to use tvig (which is the most hated templating engine to php code), then it is a cry of despair from previous experience of using php code in templates. - Elyse84 commented on April 3rd 20 at 17:37
The aim is to twig)
So I'm trying to understand how to implement it via shortcode - abdiel.Hartmann commented on April 3rd 20 at 17:40
@abdiel.Hartmann, the official ACF you say something? - charles commented on April 3rd 20 at 17:43
@charles, no mm - abdiel.Hartmann commented on April 3rd 20 at 17:46
@charles, I thought to write something like that, but not working as it should:
{% if galery is not empty %}
<p>the Idea</p>
 {{ wp.but this do_shortcode('[post_gallery]') }}
{% endif %}
- abdiel.Hartmann commented on April 3rd 20 at 17:49
April 3rd 20 at 17:30
Solution
The principle of the Twig - you can'T run PHP (it is in Blade can do everything, but that's another story). If you need something to do, such as shortcode or other function of WordPress, use Timber (read more) or write your own extension for Twig for each function.

Find more questions by tags TwigWordPress