Revisions
- May 2, 2013 @ 11:17:49 [Current Revision] by PeterLugg
- May 2, 2013 @ 11:17:16 by PeterLugg
Revision Differences
May 2, 2013 @ 11:17:16 | Current Revision | ||
---|---|---|---|
Content | |||
Unchanged: First you need to store a variable with a random number no greater than the amount of rows in the repeater: | Unchanged: First you need to store a variable with a random number no greater than the amount of rows in the repeater: | ||
Unchanged: [php]$rand_max = count(get_field( 'testimonials'));[/php] | Unchanged: [php]$rand_max = count(get_field( 'testimonials'));[/php] | ||
Unchanged: Then you need to loop through the repeater rows with an incrementing key and if the key equals the random number, then display the row: | Unchanged: Then you need to loop through the repeater rows with an incrementing key and if the key equals the random number, then display the row: | ||
Added: | |||
Added: [php] | |||
Added: <?php | |||
Added: $rand_max = count(get_field( 'testimonials')); | |||
Added: $i = 0; | |||
Added: ?> | |||
Added: <?php while(the_repeater_ field('testimonials')): ?> | |||
Added: <?php if($rand_max == $i): ?> | |||
Added: <em id="__mceDel"> | |||
Added: <?php the_sub_field('name'); ?> | |||
Added: ... | |||
Added: <?php endif; ?> | |||
Added: <?php $i++; ?> | |||
Added: <?php endwhile; ?></em> | |||
Deleted: | Added: [/php] |
Note: Spaces may be added to comparison text to allow better line wrapping.
No comments yet.