Support » Fixing WordPress » Display During Certain Day and Time

  • Resolved Aikyrie

    (@aikyrie)


    I’ve tried just about everything and I’m stumped! I’m trying to display an image only during one day of the week between certain hours. Here’s my code:

    <?php if (time() >= strtotime('Tuesday, 11:00 AM') && time() <= strtotime('Tuesday, 05:00 PM')) { ?>
    DISPLAY IMAGE
    <?php } ?>

    I’ve tried this on a PHP file by itself and it seems to work. Any ideas?

Viewing 1 replies (of 1 total)
  • I was able to do it with the following:

    <?php $c_time = mktime();
    $open = strtotime('Saturday 1pm');
    $close = strtotime('Saturday 8pm');
    if ($c_time > $open && $c_time < $close) { ?>
    
    CONTENT HERE
    
    <?php } ?>

    [Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum’s parser.]

Viewing 1 replies (of 1 total)
  • The topic ‘Display During Certain Day and Time’ is closed to new replies.