Thanks for this extension! Love it. One question, though. Can I make it change quotes daily instead of randomly? What would I need to alter in the code?
The code is well documented, here's the critical bit:
// Here we split it into lines $quotes = explode( $lineSeparator, $quotesString); // And then randomly choose a line $chosen = $quotes[ mt_rand(0, $i - 1 ) ];
I built a WP quotes plugin and one of the functions was a daily quote. I used the day of the year to find that one on my quotes file, assuming I had at least 365 quotes. You could loop through the quotes file:
foreach ($result as $row)
{
$remainder = $counter % $dayofyear;
if ($remainder == 0)
{
output the $row;
break;
}
}
Comments
The code is well documented, here's the critical bit:
// Here we split it into lines
$quotes = explode( $lineSeparator, $quotesString);
// And then randomly choose a line
$chosen = $quotes[ mt_rand(0, $i - 1 ) ];
foreach ($result as $row) { $remainder = $counter % $dayofyear; if ($remainder == 0) { output the $row; break; } }