WordPress.org

Ready to get started?Download WordPress

Forums

Random Image (14 posts)

  1. richlewt
    Member
    Posted 3 years ago #

    Hi
    I have just discovered the wonderful WordPress and am just trying to get my head around how things work. Thought first project would be to try and move over my existing site and learn as we go along.
    On my existing site I have a folder with 50 random images in it which gets displayed near the top on every page, I use a simple javascript to do this i.e.

    <script type="text/javascript">
    var pictures = 50;
    var dt = new Date();
    var hr = dt.getSeconds();
    var ra = hr % pictures;
    var re = ++ra;
    var msg="<IMG SRC=images/"+re+".jpg>";
    document.write(msg);
    </script>

    I thought it may be just a case of placing this in the header.php file within my theme but no :-(
    not as simple as that.
    Is there a simple way of adapting this to work?

    Many thanks
    Rich

  2. Tara
    Member
    Posted 3 years ago #

  3. richlewt
    Member
    Posted 3 years ago #

    Hi Thanks for taking the time to get back to me. Its not quite what I am after. I dont want to rotate the header image, just a photo that resides below it. Can your example me simply modified to do this?

  4. Tara
    Member
    Posted 3 years ago #

    Can your example me simply modified to do this?

    I am not sure what you are asking.

  5. richlewt
    Member
    Posted 3 years ago #

    Hi
    Apologies for not explaining. Check this sample site http://www.ngroadracing.org" The top banner remains the same, each time the page is refreshed a different image appears. I would like to try to recreate this.

  6. Tara
    Member
    Posted 3 years ago #

    they may be using a plugin. check for plugins here.

  7. richlewt
    Member
    Posted 3 years ago #

    Hi
    No it doesnt, it uses the javascript that I posted in the first post of this thread.

  8. Tara
    Member
    Posted 3 years ago #

  9. alchymyth
    The Sweeper & Moderator
    Posted 3 years ago #

    it does work for me in firefox3.6 and IE7.

    have you changed anything?
    what exactly was the problem?

  10. richlewt
    Member
    Posted 3 years ago #

    Hi
    Got it working now, its really neat, pleased with that. Only thing I need to sort out now is my left sidebar starts below the bottom of the image and needs to be up at the top of the page.

  11. Tara
    Member
    Posted 3 years ago #

    site url?

  12. richlewt
    Member
    Posted 3 years ago #

    Hi
    Ok, just to recap, I have included javascript as in first post of this thread into my themes/header.php file after the <div id="main"> tag.
    I have taken a screenshop to view the effect (site is currently not live and working local)
    Problem I have is right sidebar is starting at base of photo and would like it to start at top of photo. I have been playing with css file but cant seem to find how to get it to line up.
    Screenshot

  13. richlewt
    Member
    Posted 3 years ago #

    Anyone help?

  14. richlewt
    Member
    Posted 3 years ago #

    Hi
    Sorry to be a pain but can anyone give me any help on getting my right sidebar to work? If this can be cracked, its a simple way of generating random images.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.