- This topic is empty.
-
AuthorPosts
-
January 18, 2011 at 10:41 am #31286creativeMember
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.
January 18, 2011 at 10:52 am #65439Rob MacKayParticipant
// 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" : "";
?>
January 18, 2011 at 10:59 am #65441creativeMemberRob 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,
January 18, 2011 at 11:27 am #65413Rob MacKayParticipantyea 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 :)
January 18, 2011 at 12:16 pm #65400creativeMemberU RULE. Thanks,
January 18, 2011 at 5:45 pm #65381Rob MacKayParticipantNo probs :)
January 20, 2011 at 9:16 pm #65052creativeMemberRob, 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,
January 28, 2011 at 11:23 am #63495creativeMemberAny one?
January 28, 2011 at 11:41 am #63496BobMemberThats 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?
January 28, 2011 at 1:33 pm #63502creativeMemberThe 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,
February 10, 2011 at 12:25 pm #61333creativeMemberAny?
-
AuthorPosts
- The forum ‘Other’ is closed to new topics and replies.