-
-
Save mwangepatrick/c0fec6c11d44b8e620ba to your computer and use it in GitHub Desktop.
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 | |
$rows = get_field('slider_image' ); | |
$sub_field = has_sub_field('slider_image'); | |
$rand_row = $rows[ array_rand( $rows ) ]; | |
$logo_colour = get_sub_field('logo_colour'); | |
$caption = get_sub_field('the_caption'); | |
$template_directory = bloginfo('template_directory'); | |
if($rows) // if slider_image exits | |
{ | |
echo '<ul class="invisible">'; | |
$counter=0; | |
while($sub_field) // enables us to use get_sub_field | |
{ | |
if($counter<20){ | |
$counter++; | |
} | |
$rows = $rand_row; // random order of rows | |
foreach ($rows as $row) { | |
echo '<li>' . $caption . '</li>'; // displays caption | |
if (($logo_colour) == "White") { // displays white logo if selected, else grey | |
echo '<li><img src="' . $template_directory . '/logo_white.png" /></li>'; | |
} else { | |
echo '<li><img src="' . $template_directory . '/logo_grey.png" /></li>'; | |
} | |
} | |
} | |
} | |
echo '</ul>'; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment