WordPress.org

Support

Support » Installation » [Resolved] 7 days – 7 banners

[Resolved] 7 days – 7 banners

  • Hello

    I got an problem. Guess i will need your help – and – excuse my bad english, I am not from an english speaking nation.

    So , here I go:

    I want to have 7 Banners, 1 for each day. Starting from Sunday to Saturday ;). But what to do? If it where php it would be no prob after all. But, the style itself is using a style sheet. Quote like this for the banner:

    #header {

    height: 300px;
    margin-bottom: 35px;
    background: url(images/banner.jpg);
    text-align: center;

    }

    So, what to do? Hope anyone can help me out, it’s very important to me.

    /edit: I am sorry ’bout that, but i messed up the Forum :|. It’ shouldn’t be here, would be nice if a mod or someone else can push it in the right one. Thanks and sorry /

Viewing 15 replies - 1 through 15 (of 18 total)
  • “If it where php it would be no prob after all.”
    Why not define the style for the header in your header.php?

    Hm yes i thought about that, but:

    I fear that it will nearly destroy anything else.

    Beside that, i dont know where to place this in the header.php.

    I use “FallenLeaves” style, just want to replace the headers daily.
    Maybe you can say how to?

    http://wordpress.org/support/topic/37764

    maybe this thread will shed some light on how to style.

    You can do a banner.php instead of a banner.jpg, in which you check the day and do a 302 redirect. An example of this is http://photomatt.net/scripts/randomimage, but your script will be much simpler.

    Well thx for the quick help.

    But still i am very confused about what to do, and – i don’t know where to place this.

    Maybe you can grab up my quote up there and edit it the way it should look like?

    Sorry, but i am a beginner at this.

    First, the method of doing is based upon an important question. Do you want a specific banner image for a specific Day of the Week (like it says “Thursday” on the Thursday banner), or are you just happy rotating your 7 banners randomly per day?

    You are talking about changing the CSS when all that needs to be changed is the header image, right? Keep the banners about the same shape and size and the CSS will take care of itself. You just want to change the image. Please clarify this if it is wrong.

    The random rotating script mentioned up above involve putting the images in their own folder along with the script. Instead of linking to an image, you link to the script like this:

    <img src="/images/header/rotator.php" alt="blah" title="blah" />

    Then the images in the /images/header/` folder would just randomly generate WITH EVERY PAGE VIEW. Not by date. I use it on my site – just click my name here and go to any post and then refresh the screen and you will see the photograph in the sidebar change.

    There is a LOT more information on this in the article on WordPress headers at:

    http://codex.wordpress.org/Designing_Headers

    Your issue is the “by day” not by refresh. There are a TON of similar scripts at any of the following spots that will do what you want. You should be able to use them like the one mentioned above.

    http://www.hotscripts.com/
    http://php.resourceindex.com/
    http://www.php-scripts.com/
    http://www.onlyphp.com/

    If the only change you are making is with the CSS, you have a different problem. But if the only change you want is with the graphic, then you use this information.

    Yep it’ s just 1 banner per day. I guess i will try this out, looks like it can help me a lot 🙂

    Thank you for your support.

    Well.. still don’t work.

    I guess because i dont know where to wrote this in “<img src=”/images/header/rotator.php” alt=”blah” title=”blah” />”.

    It belongs in the style.css or? How must it look like?

    #header {

    height: 300px;
    margin-bottom: 35px;
    <img src=”images/head/banner1.php”>;
    text-align: center;
    }

    Don’t work for me. I tried also <img…. banner1.jpg”> to test if the link is working, but still then i only get an empty header.

    Someone can help ?

    I’m using Chetan Kunte’s “plain vanilla” theme and he explains how to set up a set of header/banner images for specific pages in the comments area of the theme at

    http://chetan.ckunte.com/archives/2005/03/07/plain-vanilla-1/

    The question is comment #76 and the answer is comment #77. You should be able to adapt this for whatever theme you’re using, etc.

    If you decide you want to just rotate images at random and not associate them with a specific page, I use Dan Benjamin’s image rotator script that he wrote about at A List Apart:

    http://www.alistapart.com/articles/betterrotator/

    I’ve got it in action on my website at http://www.sooz.com

    Oops I missread your original question. I see you want something “by day” and not “by page.” Well, in case you change your mind, maybe this will be helpful or I’m sure it can be tweaked for something day specific … I’m just not enough of a geek to know how to do that.

    <?php

    /* Path to images */
    $folder = 'http://example.com/wp-content/banners/days/';

    /* Today's day */
    $day = date('l');

    /* Extension */
    $ext = '.jpg';

    /* Join them for file path */
    $path = $folder . $day . $ext;

    /* Go! */
    header('Location: '.$path);

    ?>

    So you’ll have Sunday.jpg, Monday.jpg, etc.

    @sooz thx for your help, maybe i will come back to it if i dont get antything else to use.

    @firas thx fpr help as well, but still , you didnt answered my question really… because i still dont know where to place this stuff and how to link it from the style.css.

    Hope for help.. as always 😉

    Save that code to a file called banner.php. Customize the path and extension.

    Put banner.php in your theme folder’s images/ folder.

    In your css, change background: url(images/banner.jpg); to background: url(images/banner.php);.

    Ok it working for me so far. But I got one last question left.

    It is possible to extend this from Monday-Sunday.jpg to the Date 1st of month to 31th of month?

    I know , i didnt asked this @ the beginning, but it woul be very helpful to know this for later usage maybe.

    Just pass the right arguments to the date() function. That link looks kinda complicated at first glance but scroll down and you’ll see a table of what to send to get your desired output. In this case, instead of l, you’ll want to send j.

Viewing 15 replies - 1 through 15 (of 18 total)
  • The topic ‘[Resolved] 7 days – 7 banners’ is closed to new replies.
Skip to toolbar