[Popup Pro]Close automatically

Hi!

Is there any way to close the PopUp automatically after X seconds?

Thank you!

  • Dimitris

    Hey there Sergio,

    hope you're doing good and thanks for reaching us! :slight_smile:

    I attach you a simple MU plugin. Simply download the attached .zip file, unzip it and move the close-popup.php file to /wp-content/mu-plugins/ folder of your installation. If the mu-plugins folder doesn't exist, just create it.

    By default, the snippet will close any popup after 2 secs.

    <?php
    function close_popup() { ?>
      <a id="close-popup" style="display: none">Click</a>
      <script type="text/javascript">
      jQuery(function($){
      	$('#close-popup').click(function(e) {
      		$('.wdpu-close').click();
      	});
      	setTimeout(function() {
      		$('#close-popup').click();
      	}, 2000);
      });
      </script>
    <?php
    }
    add_action('wp_footer', 'close_popup');

    This is set through the '2000' value at the end of the script. This is a value in milliseconds as you can see, feel free to alter this to fulfill your needs. :wink:

    Warm regards,
    Dimitris

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.