Search
 
SCRIPT & CODE EXAMPLE
 

PHP

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(); 
		$image = get_sub_field('image');
	endwhile;
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 :: php retour à la ligne 
Php :: php how to count array 
Php :: php compare strings case insensitive 
Php :: php escape special characters 
Php :: laravel get latest record by date 
Php :: wordpress check shortcode exists 
Php :: Print exact sql statement executed 
Php :: Laravel Eloquent, group by month/year 
Php :: Wordpress Pagination for WP_Query 
Php :: wherebetween in laravel 
Php :: array to stdclass object php 
Php :: php current datettime us time zone 
Php :: custom bootstrap pagination laravel 
Php :: check if input file is set codeigniter 
Php :: Zend Framework 2 in a ZF1 project 
Php :: laravel gmail 
Php :: Search for text in string php 
Php :: Mask credit card number in PHP 
Php :: php counting number of chars excluding newlines 
Php :: php directory listing 
Php :: How to display data from MySQL database into HTML table using PHP 
Php :: magento debug white page 
Php :: php error display 
Php :: magento 2 get collection 
Php :: php run python script 
Php :: wordpress get category page title 
Php :: laravel descending order paginate eloquent 
Php :: view pdf file in a new tab in php 
Php :: get session id in laravel 
Php :: php Call to undefined function mb_convert_case() 
ADD CONTENT
Topic
Content
Source link
Name
7+8 =