Skip to content

Instantly share code, notes, and snippets.

@danieliser
Created October 6, 2016 02:03
Show Gist options
  • Select an option

  • Save danieliser/7a3dcaf45a92d16529b8664cc81fa2d7 to your computer and use it in GitHub Desktop.

Select an option

Save danieliser/7a3dcaf45a92d16529b8664cc81fa2d7 to your computer and use it in GitHub Desktop.
Popup Maker Loading popup scripts
<?php
add_action( 'wp_head', '_custom_head_scripts' );
function _custom_head_scripts() {
// Change this.
$popup_id = 123; ?>
<script type="text/javascript">
(function ($) {
if (document.cookie.match(/loading-popup=/)) {
$('<style>#pum-<?php echo $popup_id; ?> {display: block;}</style>').appendTo($('head'));
}
}(jQuery));
</script><?php
}
add_action( 'wp_footer', '_custom_footer_scripts' );
function _custom_footer_scripts() {
// Change this.
$popup_id = 123; ?>
<script type="text/javascript">
(function ($) {
var $popup = $('#pum-<?php echo $popup_id; ?>');
if (document.cookie.match(/loading-popup=/)) {
$(document).ready(function () {
setTimeout(function () {
$popup.fadeOut();
}, 1000);
$.pm_remove_cookie('loading-popup');
})
}
}(jQuery));
</script><?php
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment