• I would like a different header image to display on each page.
    How can I do this the template?

Viewing 8 replies - 16 through 23 (of 23 total)
  • Not sure w/o seeing your code but the order of it is usually if then elseif, then else.

    I just used the Random Image Rotator script to swap out header background images in a template. It’s totally simple to set up. Just upload the script to the same folder as your images and in your path where you normally call your image, call the script instead. (e.g. <img src="/pathto/yourfolder/scriptname.php">). You can add or remove images w/o having to edit any code.

    In CSS (for background images) it’s like this:

    background: #fff url('images/header/imagerotator.php') no-repeat;

    (assuming you have the images in the images/header subfolder in your theme)

    Thread Starter kloy

    (@kloy)

    I actually found that yesterday and tried it. The only thing is that it doesn’t rotate the images unless I wait a few minutes before clicking the next link.

    Are you having that same problem?

    It loads a random image each time you reload the page. It’s not like a JavaScript rotator. You can use just about any JavaScript rotator script but have to either add or include the script in your header.php. I have put the DW Rotator into WordPress themes.

    Thread Starter kloy

    (@kloy)

    but doesn’t the Random Image Rotator reload the header.php page everytime a link is clicked? I put more photos in the folder, and it’s rotating the way I want it to.

    Just to clarify, header.php is not a page. It is a modular template that becomes part of your pages. Whenever a page loads, header.php is called in and if that is where you have the script being called, a random image should load. Keep in mind that being random means that it is possible for the same image to show up two or more times in a row. The more images you have in the folder the less likely it is that this will happen. The script does not rotate images at all despite the name. It loads a randomly chosen image, which is not the same thing.

    Hi,

    I’m actually the author of the DW Rotator script, hadn’t realised anyone had been using it. Upon reading this thread though I think I might have to release an updated version. I might see if I can develop it into a plugin that simply reads a user supplied folder for all the images and applies the javascript accordingly. Would there be any interest in such a plugin?

    Thanks

Viewing 8 replies - 16 through 23 (of 23 total)
  • The topic ‘swapping out header images’ is closed to new replies.