Hey all,
This code was given to me by my client who swears it works, yet I can't seem to get it to function.
I'm only basically knowledgeable regarding coding. But as I understand, it's in two parts, where
variables are declared in the php portion, which are then used in the javascript snippet.
The code is simply supposed to display a number that updates daily.
Any help is greatly appreciated.
<?php
$now = time(); // or your date as well
$your_date = strtotime("2016-06-01");
$datediff = $now - $your_date;
$referrals = number_format(162250 + (floor($datediff/(60*60*24)) * 527) + (87920 + (floor($datediff/(60*60*24)) * 45)));
?>
//javascript:
<script>
//vars from template
var referrals = "<?php echo $referrals;?>";
var currentdate = new Date();
jQuery("document").ready(function() {
jQuery ("#sp-menu > div > nav > ul > li:nth-child(1) > a").html("Home");
jQuery(".referrals").html(referrals);
jQuery(".current_date").html((currentdate.getMonth()+1) + "/" + currentdate.getDate() + "/" + currentdate.getFullYear());
jQuery(window).on("scroll", function() {
var scrollPos = jQuery(window).scrollTop();
if (scrollPos <= 0) {
jQuery(".counter").fadeIn();
jQuery(".sec-nav").fadeIn();
} else {
jQuery(".counter").fadeOut();
jQuery(".sec-nav").fadeOut();
}
});
});
</script>