Support

Account

Home Forums Add-ons Repeater Field Using Repeater for Carousel with Multiple Fields

Solving

Using Repeater for Carousel with Multiple Fields

  • I know I can use the gallery add-on but I need to have custom fields that load with the images. Basically I’m trying to create an image carousel with three fields attached to each image: Title, Description, Instructions. I’m using the repeater along with the Nivo slider and I’m able to create the carousel and pull the additional fields but how do I show ONLY the active slide’s fields (description, instructions, title)?

    Here is my code so far:

    <?php 
    			$rows = get_field('idea');
    			if($rows)
    			{
    				echo '<ul>';
    			 
    				foreach($rows as $row)
    				{
    					echo '<li><img src="' . $row['image'] . '"> <h3>Description</h3>' . $row['description'] . $row['title'] . $row['instructions'] .'</li>';
    				}
    			 
    				echo '</ul>';
    			}
    ?>

    Any help would be very appreciated!

  • Hi @beliy333

    Can you explain what you mean by:
    – how do I show ONLY the active slide’s fields (description, instructions, title)?

    What is the active’s fields?

    Is this a JS thing, or a PHP thing?

    THanks
    E

  • Hi @elliot

    Thanks for the response. What I mean is when I navigate through the different images in the carousel, I’d like to show 3 additional fields that are in the same repeater field as the image.

    Please see this image as a reference. This is what I’m trying to accomplish: Referance

    So when the slide changes, I need the description, title, and instruction fields to change as well. So if slide 2 is active, then slide 2’s instruction, description and title fields are showing. When the carousel navigates to slide 3, then slide 3’s fields are showing.

    I think this is a PHP thing.

    Thanks for your time,
    Yan

  • Hi @beliy333

    Thanks for clarifying.
    What you need to do is render out ALL of the required PHP into the Carousel. Most Carousel JS plugins allow for not only an image, but for HTML as well.

    You will need to research the Carousel documentation to find out how this is possible, but once understood, you can simply modify your code to also render out the other sub fields in the correct markup.

    Does that help?

    Thanks
    E

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

The topic ‘Using Repeater for Carousel with Multiple Fields’ is closed to new replies.