Answer the question
In order to leave comments, you need to log in
Enable timer when scrolling to block, disable for registered users in Wordpress?
There is a timer code
add_action('wp_head', 'add_script_timer');
function add_script_timer() {
?>
<script type="text/javascript">
timer_num = 30;//сколько секунд показывать таймер
function timer_fc(){
if(timer_num>0){
$('#timer_num').text(timer_num);
timer_num--;
setTimeout("timer_fc()", 1000)
}else{
$('#timer_1').hide(); $('#timer_2').show();
}}
timer_fc();
</script>
<?php
}
Answer the question
In order to leave comments, you need to log in
is_user_logged_in() shows if the user is logged in.
And scrolling to the block can be tracked using intersectionObserver 'a
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question