WordPress.org

Forums

Generate Random Quotes? (11 posts)

  1. Anonymous
    Unregistered
    Posted 11 years ago #

    Similar to the Hello, Dolly thing, I suppose -- well, based from its description. I haven't actually used it. I'm after a script that will generate a random quote from an array that I've collected.
    I've seen these on a number of blogs (wordpress ones at that), but I never thought to take a look at how they were done. But now I really want one, it would suit my blog very nicely. Any ideas?

  2. James Huff
    Volunteer Moderator
    Posted 11 years ago #

    Open up the Hello, Dolly plugin in a text editor. You will notice an area in which the lyrics for "Hello, Dolly" is placed. Each line is displayed randomly one at a time. Therefore, just replace each line with one of your quotes, save the file as quotes.php, an upload it and activate it just like any plugin. Enjoy.

  3. tinarenee
    Member
    Posted 11 years ago #

  4. Anonymous
    Unregistered
    Posted 11 years ago #

    Wow, thanks! That was instantaneously gratifying. :D

  5. Anonymous
    Unregistered
    Posted 11 years ago #

    Is it possible, instead of a random quote being displayed each time someone visits the site, to have the same quote displayed for a set period of time?

  6. nwfast
    Member
    Posted 11 years ago #

    Sure is, Hesed.
    If you'd like to use javascript to generate content based on the current time, here's a link to the code you'd need:
    http://www.triumphantmedia.com/resources/notebook/index.php?p=11
    Cheers,
    nw

  7. Anonymous
    Unregistered
    Posted 11 years ago #

    Thanks for the link NW. What I have in mind, actually, would be displaying the same quote for an entire day, or maybe 2 days, then moving to a new one for the same period of time. I'll take a look at the javascript you've posted, I guess messing around with it a bit could do what I'm looking for.

  8. TechGnome
    Moderator
    Posted 11 years ago #

    Hesed - If you get this figured out, let me know.... I want to do something similar and have been thinking that it would be best done as a plugin of somekind, but I haven't found one that is all that I need. I've got something I've started with, but it is no where near finished.
    Tg

  9. Beel
    Member
    Posted 11 years ago #

  10. TechGnome
    Moderator
    Posted 11 years ago #

    Holy smokes Batman! Thanks Beel.... looks like it needs a little bit of tinkering to make it a true WP Plugin, but that should be a no brainer.
    Tg

  11. Anonymous
    Unregistered
    Posted 11 years ago #

    This is definetly the sort of thing I'm looking for. I don't really know too much PHP, but I may try to see if I can make something of it during my Christmas break.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.