Trying to get this to function, randomly chooses 1 of the 3 color choices. Is rand only capable of generating numbers? or Numbers/letters in a series.
<div onclick="location.href='<?php the_permalink() ?>';"
style="cursor:pointer;background:#<?php echo rand (DDCA73, A0AA47, ADBAE1)?>;"
clas开发者_Go百科s="post bg thickbox" id="thickbox post-<?php the_ID(); ?>">
** rand or mt_rand randomize numbers not strings. Create an array, then randomize it's key selection.
<?php
function random_color(){
$colors_avail = array("DDCA73","A0AA47","ADBAE1");
$colors_count = count($colors_avail)-1;
$color_wheel = $colors_avail[mt_rand(0,$colors_count)];
echo $color_wheel;
}
?>
<div onclick="location.href='<?php the_permalink() ?>';"
style="cursor:pointer;background:#<?php random_color(); ?>;"
class="post bg thickbox" id="thickbox post-<?php the_ID(); ?>">
精彩评论