WordPress.org

Ready to get started?Download WordPress

Forums

Plugin: Random File (10 posts)

  1. Plugin: Random File

    Description:
    Retrieve the name of a randomly chosen file in a given directory. Useful for displaying random images/logos or including text from random files onto your site (writing excerpts, multi-line quotes, etc).

    Details can be found at the plugin's homepage:
    http://www.coffee2code.com/archives/2004/07/08/plugin-random-file/

    All of my plugins can be found at:
    http://www.coffee2code.com/wp-plugins/

    Plugin updated to v1.0

    Changes in this release:

    * Renamed function from random_file() to c2c_random_file()
    * Added new reftype of 'filename' (so you can just get the filename of the random file without any directory/URL information)
    * Added optional array argument $extensions for files not to be considered in random file selection
    * Updated license and examples
    * Verified that plugin works in WP 1.5 (and still works in WP 1.2)

    [ The original thread for this plugin seems to be locked down... http://wordpress.org/support/topic.php?id=8780 ]

  2. XeroCool
    Member
    Posted 9 years ago #

    Great. Adding it to r0x0rz.info/wordpress :)

  3. dazzlegas
    Member
    Posted 9 years ago #

    Any idea how one could use Random Files for changing header graphics, when the background image (header graphic) is defined in the CSS, and not the page code?

    I'm not sure how to pull it out, without screwing up the css controlled layout.

    I can make it pull a random image, but I don't know how to make it fit back inside of the correct div.

    I'm using the Golden Gray theme, which you can see here: http://www.secretcreatures.com

    I see that some have suggested randomizing the CSS, and then defining the different images in each, but that seems like a funky way to do it. Especially when I'm tweaking the CSS all the time.

    Also, I'll likely have tons of these headers, as I like to design them.

    Thanks for any suggestions,

    Dazz.

  4. dazzlegas
    Member
    Posted 9 years ago #

    Ah... I figured it out after searching a bit longer.

    I used this randomizer:
    http://automaticlabs.com/products/rotator/

    Basically, in the CSS, instead of defining the actual image, you point it to the rotator.php... works like a charm.

    Move along.... move along.

    See at http://www.secretcreatures.com

    - daz

  5. emt036
    Member
    Posted 9 years ago #

    I use this script to rotate:
    http://photomatt.net/scripts/randomimage

    And in my CSS, I just point to the php file I saved the script as:

    #header { background: url("/path_to/images/headers/imgrotator.php") no-repeat bottom center; }

  6. emt036
    Member
    Posted 9 years ago #

    Nm, simulpost.

  7. Lorelle
    Member
    Posted 9 years ago #

    Both of these scripts, just to help future searchers, are mentioned and described in the article on the Codex for Designing Headers and deals with other issues of headers, header art, and header images.

    FYI.

  8. dazzlegas
    Member
    Posted 9 years ago #

    What a great article!

    Basically, I've learned all of these things via the forum and experimentation... except that it's taken me 2 weeks instead of 15 minutes! (reading the article.)

    Nice tips, about actually choosing images and such. Future members, rejoice!

  9. growlydidge
    Member
    Posted 8 years ago #

    I've gotten the plug-in to work, except the line that had to be entered into the functions.php seems to be "leaking" into the top of my webpage (www.growlydidge.com) and the WordPress admin page. I'm very very new to the whole php thing, so I'm not sure if I set up the functions.php file right. I have a line in there already for the sidebar widgets... I just pasted the required line for this plug-in below it. Did I forget a tag?

  10. growlydidge
    Member
    Posted 8 years ago #

    I just removed the line that the website said needed to be inserted into the functions.php... the plugin still works and the code is gone.

Topic Closed

This topic has been closed to new replies.

About this Topic