Hi @divyeshk71
Can you try to exclude the page on which you’re displaying the timer from being cached in SG Optimizer?
Best,
Nabil
Hi @nlemsieh
Actually, I have added a countdown timer in the website header top bar. So it will visible on all pages. so we can’t exclude that page from cached.
I also want to change the day’s text. Right now I have set endtime for 3 days but when it reaches 1 day the day text will be automatically changed days to day and when the day reached 00 then the days will be removed and keep the only timer. How can I do this?
Please let me know. Thanks.
Hi @divyeshk71
Actually, I have added a countdown timer in the website header top bar. So it will visible on all pages. so we can’t exclude that page from cached.
Since evergreen timer relies on browser cookies, it may not work properly when page is heavily cached.
I also want to change the day’s text. Right now I have set endtime for 3 days but when it reaches 1 day the day text will be automatically changed days to day and when the day reached 00 then the days will be removed and keep the only timer. How can I do this?
While this is not currently doable out of the box, I suggest using this workaround by adding this code to functions.php under Appearance menu > Theme Editor:
add_action('wp_print_footer_scripts', function(){
?>
<script>
(function($){
$('.hurrytimer-campaign').on('update.countdown', function(e){
if( e.offset.days === 0 ){
$(this).find('.hurrytimer-timer-block:eq(0)').hide();
$(this).find('.hurrytimer-timer-sep:eq(0)').hide();
}
if( e.offset.days === 1 ){
$(this).find('.hurrytimer-timer-block:first-child .hurrytimer-timer-label').text('Day');
}
});
})(jQuery);
</script>
<?php });
-
This reply was modified 5 years, 3 months ago by
Nabil Lemsieh. Reason: code formatting
Hi @nlemsieh
Thank you for above solution. It’s works now perfectly.
Thanks.