Last active
August 29, 2015 14:01
-
-
Save barbwiredmedia/320f4c267a290e9895ac to your computer and use it in GitHub Desktop.
ACF advanced custom fields select in a repeater field to choose content layout or, anything else, within a wordpress page.
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 if (get_field('page_content_repeater')) { ?> | |
<?php while (the_repeater_field('page_content_repeater')): ?> | |
<?php | |
/* Pull from users select choice in ACF */ | |
$choice1 = 'string_1'; | |
$choice2 = 'string_2'; | |
?> | |
<?php if (get_sub_field('your_selection_field') === $choice1) { ?> | |
<!--Your Content--> | |
<?php } elseif (get_sub_field('your_selection_field') === $choice2) { ?> | |
<!--Your alternate Content--> | |
<?php } ?> | |
<?php endwhile; ?> | |
<?php } else { ?> | |
<?php the_content(); ?> | |
<?php } ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment