Support

Account

Home Forums Add-ons Repeater Field A repeater in random order including select fields Reply To: A repeater in random order including select fields

  • Okay, so I’ve sussed it, it took a while. The two main problems I encountered were:

    1. the if/else statement for the logo, I got round it by using the input of the selection not the choice.
    2. I was using bloginfo as opposed to get_bloginfo which returns a variable.

    Here’s the final code which works a treat.

    <?php 
    $template_directory = get_bloginfo('template_directory');
    $rows = get_field('slider_image');
    shuffle ($rows);
    if($rows)
    {
    
    	foreach($rows as $row)
    	{
    		echo $row['the_caption'] . '<img src="' . $template_directory . '/logo_' . $row['logo_colour'] . '.png" />'. PHP_EOL;
    	}
     
    }
    ?>

    Thank you so much Nuro for all your help, I wouldn’t of got there without your assistance.

    I’m off to the pub now!