Created
July 25, 2014 16:34
-
-
Save brettsnippets/d09614885c5e41d98ca3 to your computer and use it in GitHub Desktop.
Flexible Content ACF
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 | |
// check if the flexible content field has rows of data | |
if( have_rows('flexible_content_field_name') ): | |
// loop through the rows of data | |
while ( have_rows('flexible_content_field_name') ) : the_row(); | |
if( get_row_layout() == 'paragraph' ): | |
the_sub_field('text'); | |
elseif( get_row_layout() == 'download' ): | |
$file = get_sub_field('file'); | |
endif; | |
endwhile; | |
else : | |
// no layouts found | |
endif; | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment