Created
April 29, 2021 23:08
-
-
Save dannydickson/db790a2142a2f3131added5df6691728 to your computer and use it in GitHub Desktop.
If we have ACF flexible content rows setup on the page, display those. Otherwise, display the standard content.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// If have flexible content rows | |
if (have_rows('layouts')) : | |
while (have_rows('layouts')) : the_row(); | |
$class = 'container'; | |
if (get_sub_field('background_color')) { | |
$class .= ' ' . get_sub_field('background_color'); | |
} | |
if (get_sub_field('background_pattern')) { | |
$class .= ' ' . get_sub_field('background_pattern'); | |
} | |
?> | |
<div class="<?php echo $class; ?>"> | |
<?php | |
if (have_rows('content')) : | |
// loop through the rows of data | |
while (have_rows('content')) : the_row(); | |
get_template_part('template-parts/flex', get_row_layout()); | |
endwhile; | |
else : | |
?> | |
<?php // if no flexible content rows, display standard content ?> | |
<div class="container"> | |
<div class="layout"> | |
<div class="column"> | |
<?php the_content(); ?> | |
</div> | |
</div> | |
</div> | |
<?php | |
endif; | |
?> | |
</div> | |
<?php | |
endwhile; | |
endif; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment