Created
May 28, 2014 20:15
-
-
Save emaildano/6b6c47ec2bc3be54fcc6 to your computer and use it in GitHub Desktop.
ACF field counter snippet.
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 | |
// get the count on the repeater field | |
// mabye use get_sub_field() instead of get_field() if it's nested | |
$count = count( get_sub_field( 'the_field' ) ); | |
// begin $count conditions | |
if ( $count > 1 ) { ?> | |
// greater than 1 | |
<?php the_field( 'great_than_1' ); ?> | |
<?php } else { ?> | |
// less than 1 | |
<?php the_field( 'less_than_1' ); ?> | |
<?php } ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment