Created
February 24, 2016 07:31
-
-
Save tyxla/7c9c7691e6101375ea07 to your computer and use it in GitHub Desktop.
Displaying nested complex Carbon Fields in the front-end templates
This file contains 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 $sections = carbon_get_post_meta( get_the_ID(), 'lk_section', 'complex' ); ?> | |
<?php if ( ! empty( $sections ) ): ?> | |
<?php foreach ( $sections as $section ): ?> | |
<section class="<?php echo esc_attr( $section['class'] ); ?>"> | |
<?php if ( ! empty( $section['lk_row'] ) ): ?> | |
<?php foreach ( $section['lk_row'] as $row ): ?> | |
<div class="<?php echo esc_attr( $row['class'] ); ?>"> | |
<?php if ( ! empty( $row['lk_column'] ) ): ?> | |
<?php foreach ( $row['lk_column'] as $column ): ?> | |
<div class="<?php echo esc_attr( $column['class'] ); ?>"> | |
... column content goes here ... | |
</div> | |
<?php endforeach ?> | |
<?php endif ?> | |
</div> | |
<?php endforeach ?> | |
<?php endif ?> | |
</section> | |
<?php endforeach ?> | |
<?php endif ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment