Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save denisbouquet/3f9b3ab18cdb531d9406a28983c4529b to your computer and use it in GitHub Desktop.
Save denisbouquet/3f9b3ab18cdb531d9406a28983c4529b to your computer and use it in GitHub Desktop.
<?php
if (have_rows('sections')) {
while (have_rows('sections')) {
the_row();
if (get_row_layout() == "text_section") {
$background_colour = get_sub_field('background_colour');
if( have_rows('text_element') ) {
?>
<section class="<?php echo $background_colour; ?>">
<div class="container">
<article class="mod-text mod-padding mod-maxw">
<?php
while ( have_rows('text_element') ) {
the_row();
$background_colour = get_sub_field('background_colour');
if(get_row_layout() == "wysiwyg_editor") {
echo get_sub_field('editor');
}
elseif(get_row_layout() == "cta") {
?>
<div class="cta">
<a href="<?php echo get_sub_field('cta_url'); ?>"><?php echo get_sub_field('cta_label'); ?></a>
</div>
<?php
}
elseif(get_row_layout() == "accordion_single") {
?>
<ul class="mod-accordion">
<?php
while ( have_rows('accordion_content') ) {
the_row();
?>
<li>
<div class="mod-accordion--toggle">
<p><strong><?php echo get_sub_field('accordion_title'); ?></strong></p>
<span class="icon">+</span>
</div>
<div class="mod-accordion--content">
<div>
<?php echo get_sub_field('accordion_copy'); ?>
</div>
</div>
</li>
<?php
}
?>
</ul>
<?php
}
}
?>
</article>
</div>
</section>
<?php
}
if (get_row_layout() == "video") {
?>
<article>
<div class="mod-video">
<a href="<?php echo get_sub_field('video_url'); ?>" class="samewindow mod-video-popup">
<img alt="video poster" src="<?php echo get_sub_field('video_poster_image'); ?>">
<span class="play-icon"></span>
</a>
</div>
</article>
<?php
}
// etc
}
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment