title: Conditional display check using Twig Engine in Wordpress with ACF Repeater to setup image and video carousel
body: <p>I am trying to build a justified mixed image and video carousel with the owl-carousel plugin withiin wordpress. I am building this based on a Twig engine environment &quot;Unlimited Elements Widget Creator for Elementor&quot; and using a ACF repeater with two subfields for the content. One for the image and one for the video.</p>
  <p>Now I try to setup the logic that &quot;when there is a video in the acf repeater video field then use the video DIV, if not use the image DIV.&quot; So the carousel shows either an image or a video depending if there is a video uploaded to the item.</p>
  <p>Problem is, what ever I try to check against within the ACF Repeater item loop the carousel either uses only the Image DIVs for all items OR the video DIVs for all items, regardless of either there is a video for the specific item or not.</p>
  <p>Here is my testsetup:</p>
  <pre><code>&lt;div class=&quot;owl-carousel owl-theme&quot; style=&quot;direction:ltr; overflow:hidden;&quot; id=&quot;{{uc_id}}&quot;&gt;
  
      {% for item in current_post.cf_projekt_gallery %}
  
          {% if &quot;.mp4&quot; in &quot;{{item.projekt_gallery_video}}&quot; %}
              &lt;div class=&quot;item-video&quot;&gt;
                  &lt;video controls preload=&quot;none&quot; width=&quot;auto&quot; height=&quot;{{desktop_height}}&quot; poster=&quot;{{item.projekt_gallery_image}}&quot;&gt;
                      &lt;source src=&quot;{{item.projekt_gallery_video}}&quot; type='video/mp4' /&gt;
                  &lt;/video&gt;
              &lt;/div&gt;
          {% else %}
              &lt;div class=&quot;item&quot; style=&quot;position:relative;&quot;&gt;
                  &lt;a &gt;&lt;img src=&quot;{{item.projekt_gallery_image}}&quot; style=&quot;width:auto;&quot;&gt;&lt;/a&gt;
              &lt;/div&gt;
          {% endif %}
    
      {% endfor %}
  
  &lt;/div&gt;
  </code></pre>
  <p>Anyone seeing what I am doing wrong?</p>
  <p>Thanks!</p>