Created
July 7, 2014 00:09
-
-
Save ajithrn/16f8c67541dadc87f5b3 to your computer and use it in GitHub Desktop.
Wordpress: ACF Flexible
This file contains hidden or 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('sb_blocks') ): | |
// loop through the rows of data | |
while ( have_rows('sb_blocks') ) : the_row(); | |
if( get_row_layout() == 'sbb_image_tile' ): ?> | |
<section class="sidebar-block"> | |
<?php $sb_img = get_sub_field( 'sbbi_image' ); ?> | |
<a href="<?php the_sub_field( 'sbbi_url' ); ?>"> | |
<img src="<?php echo $sb_img['sizes']['sidebar-thumb']; ?>" alt="<?php the_sub_field( 'sbbi_title' ); ?>"> | |
</a> | |
</section> | |
<?php elseif( get_row_layout() == 'sb_content' ): | |
$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