Shuffle custom fields

<?
$meta = get_post_custom_values("CustomFieldName");
$metas = shuffle($meta);
$count = 0;
foreach ($meta as $m) {
$m = explode(", ", $m);
echo "<div>";
echo "<a href="" . $m[1] . "" target="_blank">";
echo "<img src="/wp-content/uploads/" . $m[2] . "" width="100">";
echo "</a>";
echo "</div>";
$count++;
if ($count == 12) break;
}
?>

0 Comments

You must be logged in to post a comment.