Last active
August 29, 2015 14:25
-
-
Save bodiequirk/c672d08b5684f70d488f to your computer and use it in GitHub Desktop.
Text Blocks in Dynamik with 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 | |
// Add custom content to posts | |
add_action( 'genesis_entry_content', 'ch_add_text_block'); | |
function ch_add_text_block() { | |
// check if the flexible content field has rows of data | |
if( have_rows('content') ): | |
// loop through the rows of data | |
while ( have_rows('content') ) : the_row(); | |
if( get_row_layout() == 'text_block' ): | |
the_sub_field('left_column_text'); | |
the_sub_field('right_column_text'); | |
elseif( get_row_layout() == 'download' ): | |
$file = get_sub_field('file'); | |
endif; | |
endwhile; | |
else : | |
// no layouts found | |
endif; | |
} | |
genesis(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment