“Dapatkan ACF Repeater Field” Kode Jawaban

Dapatkan ACF Repeater Field

if( have_rows('rating_field') ):
  while ( have_rows('rating_field') ) : the_row();
    $title = the_sub_field('rating_title');
    $number = the_sub_field('rating_number');

    echo $title;
    echo $number;
  endwhile;
else :
endif;
Developers

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

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
/**
 * Field Structure:
 *
 * - parent_repeater (Repeater)
 *   - parent_title (Text)
 *   - child_repeater (Repeater)
 *     - child_title (Text)
 */
if( have_rows('parent_repeater') ):
    while( have_rows('parent_repeater') ) : the_row();

        // Get parent value.
        $parent_title = get_sub_field('parent_title');

        // Loop over sub repeater rows.
        if( have_rows('child_repeater') ):
            while( have_rows('child_repeater') ) : the_row();

                // Get sub value.
                $child_title = get_sub_field('child_title');

            endwhile;
        endif;
    endwhile;
endif;
Jealous Jackal

Jawaban yang mirip dengan “Dapatkan ACF Repeater Field”

Pertanyaan yang mirip dengan “Dapatkan ACF Repeater Field”

Lebih banyak jawaban terkait untuk “Dapatkan ACF Repeater Field” di PHP

Jelajahi jawaban kode populer menurut bahasa

Jelajahi bahasa kode lainnya