Show popup once for new website page visitors !

So if you want to show the popup on the website for first time visitors then follow this..

First of all add this code to theme footer.php file ..

<div id="letcont" class="modal fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Contact Us for Learn More</h4>
</div>
<div class="modal-body"> <?php echo do_shortcode('

Error: Contact form not found.

');?> </div>
</div>
</div>
</div>

 
You can change the Contact form 7 shortcode to your one code.

 
And after that.. add this script…
 
<script type="text/javascript">
jQuery(document).ready(function() {
/// show div first time visitors
var isshow = sessionStorage.getItem('isshow');
if (isshow== null) {
sessionStorage.setItem('isshow', 1);
// Show popup here
setTimeout(function(){
jQuery('#letcont').modal('show');
},10000);
}
});
</script>

 
Here is the difference between Local and Session storage..
 

You can change the time to show popup too.. now i adjusted to show after 10 second.. you can change number 10000 to your one..
1 second = 1000 .. so calculate as per your need.
 
popup new visitor show-popup first time visitor

 
That’s it 🙂 .. if still need help don’t forget to comment or directly contact with us…. Thanks 🙂

If this help you then.. Can you buy a Cup of Coffee for me by nst webcreation paypal--OR-- nst webcreation blog coffee cup

Published by

NST

Myself Narender Singh Thakur ( NST ) and i share my Experience/Knowledge and Tricks for folks and beginners to solve their issues while making websites through this Planet.

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Click to Chat