“Repeater ACF” Kode Jawaban

ACF Repeater

<?php if( have_rows('repeater_field_name') ): 
	while( have_rows('repeater_field_name') ): the_row(); 
		$image = get_sub_field('image');
	endwhile;
endif; ?>
Hilarious Heron

Repeater ACF

<?php if( have_rows('slides') ): ?>
    <ul class="slides">
    <?php while( have_rows('slides') ): the_row(); 
        $image = get_sub_field('image');
        ?>
        <li>
            <?php echo wp_get_attachment_image( $image, 'full' ); ?>
            <p><?php the_sub_field('caption'); ?></p>
        </li>
    <?php endwhile; ?>
    </ul>
<?php endif; ?>
Angry Aardvark

ACF Repeater

<?php if( have_rows('repeater_field_name') ): while ( have_rows('repeater_field_name') ) : the_row(); ?>
  <?php the_sub_field('sub_field_name'); ?>
<?php endwhile; else : endif; ?>
Ghayas

ACF Repeater

<?php 
$rows = get_field('repeater_field_name');
if( $rows ) {
    echo '<ul class="slides">';
    foreach( $rows as $row ) {
        $image = $row['image'];
        echo '<li>';
            echo wp_get_attachment_image( $image, 'full' );
            echo wpautop( $row['caption'] );
        echo '</li>';
    }
    echo '</ul>';
}
Curious Crossbill

Opsi ACF Repeater

<?php if( have_rows('repeater', 'option') ): ?>

    <ul>

    <?php while( have_rows('repeater', 'option') ): the_row(); ?>

        <li><?php the_sub_field('title'); ?></li>

    <?php endwhile; ?>

    </ul>

<?php endif; ?>
Nutty Nightingale

ACF Repeater

<?php 
if( have_rows('repeater_field_name') ) {
    while( have_rows('repeater_field_name') ) {
        the_row();
        $first_row_title = get_sub_field('title');
        // Do something...
        break;
    }
}
Jealous Jackal

Jawaban yang mirip dengan “Repeater ACF”

Pertanyaan yang mirip dengan “Repeater ACF”

Lebih banyak jawaban terkait untuk “Repeater ACF” di PHP

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya