Search
 
SCRIPT & CODE EXAMPLE
 

PHP

get 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;
Comment

acf repeater

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

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; ?>
Comment

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; ?>
Comment

acf options 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; ?>
Comment

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>';
}
Comment

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;
    }
}
Comment

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;
Comment

acf repeater

<?php
$rows = get_field('repeater_field_name' );
if( $rows ) {
    $first_row = $rows[0];
    $first_row_title = $first_row['title'];
    // Do something...
}
Comment

PREVIOUS NEXT
Code Example
Php :: E: Unable to locate package php7.2-mbstring 
Php :: valide email php 
Php :: php self submit 
Php :: main.WARNING: Session size of 315269 exceeded allowed session max size of 256000 
Php :: laravel migration change column name 
Php :: log laravel 
Php :: array merge laravel 
Php :: get url php 
Php :: remove all html codes using php 
Php :: clear all cache in laravel 
Php :: php set error log file 
Php :: foreach limit laravel 
Php :: wp_get_attachment_image class 
Php :: laravel updateorcreate 
Php :: php split string by enter 
Php :: why css not working with php file 
Php :: php discord webhook 
Php :: setup_postdata not working 
Php :: php add string inside string at position 
Php :: reload page in php 
Php :: str_includes php 
Php :: unique value when two columns laravel migration 
Php :: regex for email php 
Php :: how to add property to the request object 
Php :: insert rows in migrations laravel 
Php :: wp_mail html content 
Php :: Invalid route action: [AdminAppHttpControllersAdminOrdersController]. 
Php :: Wordpress Pagination for WP_Query 
Php :: PHP auto refresh page 
Php :: remove html from string php 
ADD CONTENT
Topic
Content
Source link
Name
1+8 =