- shuffle($quotes); voor willekeurige volgorde
- array_slice($quotes, 0, 2) om alleen eerste 2 te tonen (al dan niet i.c.m. shuffle())… alleen telt hij ook lege values mee.
- if ( $quote[‘quote’] ) om alleen niet-lege mee te nemen
$quote1 = get_field('quote_1');
$quote2 = get_field('quote_2');
$quote3 = get_field('quote_3');
$quote4 = get_field('quote_4');
$quotes = array($quote1,$quote2,$quote3,$quote4);
shuffle($quotes);
$quotex = array_slice($quotes, 0, 2);
foreach ( $quotex as $quote )
{
if ( $quote['quote'] )
{
echo "<div class='quote mt mt_s kader'>";
$quoteimg = $quote['afbeelding'];
if ( $quoteimg )
{
echo "<img src=";
echo esc_url($quoteimg['url']);
echo " alt=" . esc_attr($quoteimg['alt']) . " />";
}
echo "<p>" . $quote['quote'] . "</p>";
echo "<p><strong>" . $quote['persoon'] . "</strong></p>";
echo "</div>";
}
}