Home › Forums › Other › Best countdown timer method for WP site › Re: Best countdown timer method for WP site
June 11, 2013 at 3:52 pm
#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.