Support » Themes and Templates » Howto: Create a random header image using a custom function

  • I’ve created a basic custom function for use inside theme’s…

    It will grab a random image and place it wherever you place the function…

    Instructions for install can be found here…
    http://www.t31os.co.uk/?p=53

    This is the first of 2 functions i’m writing, this one deals with <img src="" /> based images.

    Usage::
    wp_rand_img( $args );
    or
    <?php wp_rand_img( $args ); ?>
    depending how your theme code is laid out..

    Optional arguments::
    border
    width
    height
    alternate text

    Example::
    wp_rand_img();

    Output::
    <img src="themepath/images/myimage1.jpg" border="0" alt="" />

    *where 1 is a random number, function supports 5 images as default*

    Example:: WIDTH, HEIGHT & ALT text
    wp_rand_img('','width="100"','height="80"','my image')

    Output::
    <img src="themepath/images/myimage1.jpg" border="0" width="100" height="80" alt="my image" />

    Please see my website post for more in-depth information on usage…

    If you would like one to randomise CSS background images you’ll need to wait for my next post with the CSS based function (shouldn’t be long, just few minor bits left to do).

    Let me know what you think, or any suggestions…

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Howto: Create a random header image using a custom function’ is closed to new replies.