Need help to utilize the Owl Carousel shortcode plugin

@01K According the documentation of the ‘shortcode-core’ plugin, shortcodes can be used inside Twig.

The following is a sample for embedding the Owl Carousel inside a *.html.twig template.

{% set carousel = "[owl-carousel items=1 nav=true]" %}
{% for image in page.media.images %}
    {% set carousel = carousel~"<img src=\""~image.url~"\">" %}
{% endfor %}
{% set carousel = carousel~"[/owl-carousel]" %}

{{ carousel|shortcodes }}

Note:

  • If you need different options per page, you’ll need to add these options dynamically into the first code line.
3 Likes