Forums

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

Home Forums Other Best countdown timer method for WP site

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #45453

    I’m creating a temporary page for my site, to be something professional while I develop the main site. It will all be WP based.

    I want to run a countdown timer on the temp site but don’t know which direction to go. Since it’ll be a WP site, a WP Plugin makes sense. But would it be better to hard code something with JQuery or something?

    I’m fairly competent and learning but am not a pro so any advice/guidance is great appreciated.

    So, WP Plugin vs. JQuery (or other) hard code solution?

    #138368
    Alen
    Participant

    //place function in functions.php
    function countdown_to_launch($month, $day, $year)
    {
    $today = time();
    $launch_date = mktime(0,0,0,$month,$day,$year);
    $difference = ($launch_date – $today);
    $number_of_days = (int)($difference/86400);

    echo “

    Launch in {$number_of_days} days

    “;
    }

    //call the function in your template files
    countdown_to_launch(1,21,2014);

    Simple time difference countdown. Not sure if you need it to be interactive, then you might decide to go with JavaScript.

    #139181

    Thanks to both FragaGeddon and AlenAbdula for the info. Big help.

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