Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Facebook Sign In with Google Sign In with OpenID Sign In with Twitter

Categories

In this Discussion

Who's Online 11

CurtisOdenMatthew2Dericgilletteleafmonster422 +6 guests

Random Quotes

This discussion is related to the Random Quotes addon.
Random Quotes

Comments

  • 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 ) ];
  • Posts: 1,406
    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;
    }
    }
  • Posts: 19
    This is cool.. Gonna hack it up I think to randomly grab quotes from the forums though, as opposed to from a text file :)
This discussion has been closed.