Quantcast
Channel: Tagged with repeater - Plugin Support
Viewing all articles
Browse latest Browse all 160

Nested Flexible Content within a Repeater

$
0
0
Hi everyone,

I've searched for an answer but am coming up blank. I've created the code for what I think will provide a way to display Flexible Content layouts within a Repeater row. On my live site the code does loop through the correct layouts, but none of the sub_fields are displaying. Any help would be appreciated.




<?php<br />/*
Template Name: Stacked Page Template
*/
?>

<?php get_header(); ?>



<?php if ( have_posts() ) : ?>

<?php while ( have_posts() ) : the_post(); ?>

<?php if( get_field("section")): // Repeater: Section ?>

<?php while( has_sub_field("section")): ?>

" class="<?php the_field("class"); ?>">

img src="?php the_field(" alt="image" />" />


<?php while( has_sub_field("elements")): // Flexible Content: Elements ?>

<?php if( get_row_layout() == "hero" ): // Layout: Hero ?>




<?php the_sub_field("hero-h1"); ?>





<?php the_sub_field("hero-h2"); ?>






a class="btn btn-primary-action" rel="nofollow" href="?php the_sub_field(">">
<?php the_sub_field("action-button-primary-text"); ?>



a class="btn btn-primary-action" rel="nofollow" href="?php the_sub_field(">">
<?php the_sub_field("action-button-secondary-text"); ?>








<?php elseif( get_row_layout() == "headline-paragraph" ): // Layout: Headline and Paragraph ?>

<?php the_sub_field("justification"); ?> layout-headline-paragraph">



<?php the_sub_field("headline"); ?>





<?php the_sub_field("paragraph"); ?>




<?php elseif( get_row_layout() == "image" ): // Layout: Image ?>

layout-image">



img src="?php the_sub_field(" alt="image" />" />





<?php elseif( get_row_layout() == "2-column" ): // Layout: 2 Column ?>

layout-2-column" id="<?php the_sub_field("id"); ?>">



<?php $selectvar = get_sub_field("column-widths"); ?>

<?php if($selectvar == "50-50") { ?>


img src="?php the_sub_field(" alt="image" />" />
<?php the_sub_field("column-left-paragraph"); ?>



img src="?php the_sub_field(" alt="image" />" />
<?php the_sub_field("column-right-paragraph"); ?>


<?php } elseif($selectvar == "35-65") { ?>


img src="?php the_sub_field(" alt="image" />" />
<?php the_sub_field("column-left-paragraph"); ?>



img src="?php the_sub_field(" alt="image" />" />
<?php the_sub_field("column-right-paragraph"); ?>


<?php } elseif($selectvar == "65-35") { ?>


img src="?php the_sub_field(" alt="image" />" />
<?php the_sub_field("column-left-paragraph"); ?>



img src="?php the_sub_field(" alt="image" />" />
<?php the_sub_field("column-right-paragraph"); ?>


<?php } ?>





<?php elseif( get_row_layout() == "3-column" ): // Layout: 3 Column ?>

<?php the_sub_field("justification"); ?> layout-3-column" id="<?php the_sub_field("id"); ?>">




img src="?php the_sub_field(" alt="image" />" />
<?php the_sub_field("column-1-headline"); ?>
<?php the_sub_field("column-1-paragraph"); ?>



img src="?php the_sub_field(" alt="image" />" />
<?php the_sub_field("column-2-headline"); ?>
<?php the_sub_field("column-2-paragraph"); ?>



img src="?php the_sub_field(" alt="image" />" />
<?php the_sub_field("column-3-headline"); ?>
<?php the_sub_field("column-3-paragraph"); ?>


<?php endif; ?>

<?php endwhile; ?>




<?php endwhile; ?>


<?php endif; ?>

<?php endwhile; else: ?>

<?php _e("Sorry, this page does not exist."); ?>

<?php endif; ?>



<?php get_footer(); ?>


Viewing all articles
Browse latest Browse all 160

Latest Images

Trending Articles



Latest Images