0

I have for each loop return an array

<?php foreach( get_uf_repeater( 'clients' ) as $document_files ): extract( $document_files ) ?>
<div class="ui-grid-a my-breakpoint">
    <div class="ui-block-a"><a href="<?PHP echo $website_url ?>" target="_blank"><img src="<?php echo $project_image ?>" title="Project image" /><div><?php echo $project_detailes ?></div></a></div>
    <div class="ui-block-b"><a href="<?PHP echo $website_url ?>" target="_blank"><img src="<?php echo $project_image ?>" title="Project image" /><div><?php echo $project_detailes ?></div></a></div>
</div>
<?php endforeach ?>

how can i jump to the next array for the second line "" instead of displaying the same of the first one, I assume I need nested loop but didnt know how do it exactly.

1 Answer 1

0

You could use array_chunk

<?php foreach (array_chunk(get_uf_repeater( 'clients' ), 2, true) as $array) { ?>
    <div class="ui-grid-a my-breakpoint">
        <?php foreach($array as $document_files) { ?>
            <?php extract( $document_files ); ?>
            <div class="ui-block-a"><a href="<?PHP echo $website_url ?>" target="_blank"><img src="<?php echo $project_image ?>" title="Project image" /><div><?php echo $project_detailes ?></div></a></div>
        <?php } ?>
    </div>
<?php } ?>
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.