Created
October 6, 2016 02:03
-
-
Save danieliser/7a3dcaf45a92d16529b8664cc81fa2d7 to your computer and use it in GitHub Desktop.
Popup Maker Loading popup scripts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?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