Search
 
SCRIPT & CODE EXAMPLE
 

PHP

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

acf repeater example count

$count = count(get_field('repeater_name'));
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 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 :: php file get content replacing & with &amp; 
Php :: php extract email address from string 
Php :: php parse json 
Php :: php remove double spaces to single space 
Php :: laravel blade auth check 
Php :: laravel check old password 
Php :: laravel s3 presigned url 
Php :: laravel modules slowdown 
Php :: shoulder blade technical name 
Php :: laravel migrate only new tables 
Php :: php show error 
Php :: php loop through objects 
Php :: alert a php variable 
Php :: I cannot login to my CPanel hosted Laravel Application, my SSL has expired 
Php :: laravel required if another field has value 
Php :: phpunit filter 
Php :: how check if method is not in class in php 
Php :: different days in carbon laravel between different dates 
Php :: pdo fetchall as object 
Php :: codeigniter where_not_in 
Php :: php convert link to embed youtube 
Php :: install ext-ldap php 7.2 
Php :: wp_query item count 
Php :: how to write json to file in php 
Php :: cmd run powershell command 
Php :: laravel public access inserver using htaccess 
Php :: operador in laravel 
Php :: how to add woocommerce cart counter 
Php :: php why " " not new line 
Php :: carbon to mysql datetime 
ADD CONTENT
Topic
Content
Source link
Name
1+1 =