Skip to content

Instantly share code, notes, and snippets.

@chekle
Created September 7, 2023 04:31
Show Gist options
  • Save chekle/6ecdc9d2cf479ea1bd71848d6d633eb4 to your computer and use it in GitHub Desktop.
Save chekle/6ecdc9d2cf479ea1bd71848d6d633eb4 to your computer and use it in GitHub Desktop.
Alternating layouts ACF / PHP
<?php $counter = 0; if(get_sub_field('timeline')): ?><?php while(has_sub_field('timeline')): ?>
<?php if ($counter % 2 === 0) :?>
<?php else: ?>
<?php endif; ?>
<?php $counter++; endwhile; ?><?php endif; ?>
---------------------------
$layout = 1;
<?php if ( $layout & 1 ) { ?>
<?php } else { ?>
<?php } ?>
$layout++;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment