Carousel

Example 1: Simple carousel

Simple carousel with 4 cards

Related components:

Code

<?php
    // Example data. In reality this data comes from the block's ACF fields.
    $fields = [
        'entries' => [
            ['title' => 'Entry 1', 'content' => 'This is the content for entry 1' ],
            ['title' => 'Entry 2', 'content' => 'This is the content for entry 2' ],
            ['title' => 'Entry 3', 'content' => 'This is the content for entry 3' ],
            ['title' => 'Entry 4', 'content' => 'This is the content for entry 4' ],
        ],
    ];
?>

<?php if ( is_array( $fields['entries'] ) ) { ?>
    <?= tb_render_carousel_head() ?>
        <?php foreach ( $fields['entries'] as $entry ) { ?>
            <div class="entry tb-card">
                <div class="tb-card-title" style="background-color:yellow; min-height: 200px;">
                    <?= $entry['title'] ?>
                </div>
            </div>
        <?php } ?>
    <?= tb_render_carousel_foot() ?>
<?php } ?>

Result

Popup content