Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Other Link in a post to appear at a certain time

  • This topic is empty.
Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #31286
    creative
    Member

    I am looking for a php or jquery (probably) script that does this: There is WordPress Page that is highly customized, that will need a link to appear at a certain time (Saturday morning), then disappear 8 hours later. I need this to run by it self. The link will change weekly and I can add the new link every week. Please help.

    #65439
    Rob MacKay
    Participant


    // returns true or false based on if it's a Saturday morning or not - should do anyway :D

    function testdate($date = getdate()) {

    if($date == 6 && $date <= 12) {

    return true;

    } else {

    return false;

    }

    }


    // you can then use it like this

    echo (testdate()) ? "Link" : "";

    ?>

    #65441
    creative
    Member

    Rob u rule. Let me ask you a Q:

     if($date == 6 && $date <= 12) {

    Does this calls on which day to do that? I want to test it today. Would it be that if I change 6 to 3, that it would run tomorrow? Just to test it. Then I could fix the date again and reset the whole thing?

    Thanks,

    #65413
    Rob MacKay
    Participant

    yea sun to sat is the order – sunday is 0 sat is 6

    the clock is 24 hours – so 00 to 12 are morning, 13 to 23 are afternoon/evening

    so today is Tuesday, you could do:

    if($date == 2 && $date <= 17)

    and it should display for the next 33 mins, then go off :)

    #65400
    creative
    Member

    U RULE. Thanks,

    #65381
    Rob MacKay
    Participant

    No probs :)

    #65052
    creative
    Member

    Rob, I finally got around to test the script, but it gives me an error! What should I do? The error says: Parse error: syntax error, unexpected ‘(‘, expecting ‘)’ i

    I add to the script the address of the doc that needs to appear here:


    Documento

    Thanks,

    #63495
    creative
    Member

    Any one?

    #63496
    Bob
    Member

    Thats probably not the whole error its giving. There must be some more that seems is cut off here on the forums. Can you please post the whole error and the code you’re using this with?

    #63502
    creative
    Member

    The page does not load at all. But it produces this error.


    Parse error: syntax error, unexpected '(', expecting ')' in /home/yisrael/public_html/wp-content/themes/cmy-wordpress/page-events.php on line 24

    The code I use is:



    // returns true or false based on if it's a Saturday morning or not - should do anyway :D
    function testdate($date = getdate()) {if($date == 5 && $date <= 13) {return true;} else {return false;}}
    // you can then use it like this
    echo (testdate()) ? "Link" : "";
    ?>

    I hope you can help me.

    Thanks,

    #61333
    creative
    Member

    Any?

Viewing 11 posts - 1 through 11 (of 11 total)
  • The forum ‘Other’ is closed to new topics and replies.