Skip to content

Instantly share code, notes, and snippets.

@rwdevpixelparlor
Last active January 25, 2018 17:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rwdevpixelparlor/601157cefc1cdd1a2fa1c27d569bbdfe to your computer and use it in GitHub Desktop.
Save rwdevpixelparlor/601157cefc1cdd1a2fa1c27d569bbdfe to your computer and use it in GitHub Desktop.
<?php
// functions.php
function wpb_bg() {
$rand = array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f');
$color ='#'.$rand[rand(0,15)].$rand[rand(0,15)].$rand[rand(0,15)].
$rand[rand(0,15)].$rand[rand(0,15)].$rand[rand(0,15)];
echo $color;
}
?>
<body
<?php
// page.php or whatever page file you are using.
body_class(); ?> style="background-color:<?php wpb_bg();
?>"
>>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment