I want a random CSS style file to load on my site with each page view so I can play with colors backgrounds.
So I put all my styles in a folder, I named them 1.css
, 2.css
, etc. and I have added:
<link rel='stylesheet' id='name-random-color-css' href='http://www.url.com/wp-content/themes/themename/inc/rcolor/<?php echo mt_rand(1, 9) ?>.css' type='text/css' media='all' />
in the header.
It works but I know this is not the proper way to include styles in WordPress. I should utilize the wp_enqueue_style
function in the functions.php
file, but I don't know how to combine the two to make it work.