Hello!
I have an issue with a splash screen on one of my websites, it displays as I want it to but is popping up on every page when it needs to just pop up once on the homepage
The code below is what we have in our php file currently - Is there anything we can add to the below restrict the pages to just the homepage?
See code below:
<?php
$date_valid = strtotime('14-10-2021') < time() && time() < strtotime('14-10-2022');
$show_splash = true;
setcookie( 'cookies_set', true, time() + 86400*30, '/', cmw.net', true);
if(isset($_COOKIE['cookies_set']) && !isset($_COOKIE['showSplash'])) {
setcookie( 'showSplash', true, time() + 86400, '/', 'cmw.net', true);
$show_splash = true;
}
?>
<?php if($show_splash && $date_valid): ?>
<div id="splashOverlay" class="splash-overlay" onclick="closeSplash()">
<div class="splash-container">
<div class="splash-close" onclick="closeSplash()">
<i class="fa fa-times-circle" style="color: #000;font-size: 38px;"></i>
</div>
<!-- /43271057/cmw_interstitial_640x480 -->
<div id="div-gpt-ad-1411564579020-0"><script type="text/javascript"> googletag.cmd.push(function() { googletag.display('div-gpt-ad-1411564579020-0'); });
</script></div>
</div>
</div>
<?php endif; ?>
<script type="text/javascript">
function closeSplash() {
document.getElementById("splashOverlay").style.display = "none";
}
</script>
Thanks in advance