Support

Account

Home Forums Add-ons Flexible Content Field Flexible Slider Content

Solving

Flexible Slider Content

  • Hello!

    I’m building a hero slider that is able to accept either a video embed or an image. IU want users to be able to create a slide and then insert either of the content types in it. And then be able to repeat the process of creating infinite slides. I’m thinking I can use the flexible content but its not giving me what I want. Here’s how I’m structuring it…

    – Repeater
    — Flexible Content
    — Video
    — Image

    Shouldn’t that give the user the option of selecting either a video embed or an image? Clearly not because the output is not that. It is creating a layout where the user can repeatedly add a video AND an image together.

    What am I doing wrong here?

    Thanks in advance!

  • Ok, here’s what I’ve come up with for the code. Its completely breaking my page. Hmmmmm…any help would be very appreciated. Thanks!

    <?php
        if (have_rows('add_resorts_hero_image_slide')) {
            while (have_rows('add_resorts_hero_image_slide')) {
                the_row();
        
        if (have_rows('choose_resorts_hero_slider_content')) {
            while (have_rows('choose_resorts_hero_slider_content')) {
                    : the_row();
    
           echo '<li class="orbit-slide">'
            
           if( get_row_layout() == 'resorts_slider_video' ):
    
            	the_sub_field('add_resorts_hero_slider_video');
    
            elseif( get_row_layout() == 'resorts_slider_video' ): 
    
            	the_sub_field('add_resorts_hero_slider_image');
        
          } 
        }
       echo '</li>'
      } 
    }
    ?>
  • Hi @robertrhu

    I believe I’ve answered you here: https://support.advancedcustomfields.com/forums/topic/flex-content-in-repeater/. Could you please reply to that thread instead?

    Thanks πŸ™‚

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.