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 // Ignore this first line when copying to your child theme's functions.php file. | |
/** | |
* Send a video link to a popup using a URL in a data attribute. | |
*/ | |
function send_video_link_to_popup() | |
{ ?> | |
<script type="text/javascript"> | |
jQuery(document).ready(function($) { | |
const popupID = 85, // Change to your popup IDs. |
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 // Ignore this first line when copying to your child theme's functions.php file. | |
/** | |
* Based on https://youtu.be/zml-xz78o2Q | |
*/ | |
function send_link_to_popup() { ?> | |
<script type="text/javascript"> | |
jQuery(document).ready(function ($) { | |
const popupID = 1728, // Change to your popup IDs. | |
sel = '#my-button'; // Change to your button's CSS selector. Can also be '#my-button > a' if needed. |
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
<!-- | |
Use a "button" to launch the popup that has the form. | |
Note that in this example, the popup trigger classes (popmake-nnnn and pum-trigger) are on the wrapping div tag. | |
That's because the Block editor adds custom classes to wrapper elements not the actual element. | |
If you can/want to edit the HTML, you can add the default click trigger class (popmake-nnnn) directly to the link (a tag). | |
e.g. <a class="wp-block-button__link popmake-1689" href="https://yourcool.site/">Cool Site</a> | |
Popup Maker will see that popmake-nnn class and add the pum-trigger class to the link to launch the popup on a click. |
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
let firstNoId = true; | |
let forms = []; | |
let noIds = []; | |
let out = ""; | |
/** Place a border around forms with no ID set. */ | |
document.querySelectorAll("form").forEach((f) => { | |
if (!f.hasAttribute("id")) { | |
if (firstNoId) { | |
firstNoId = false; |
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 // Ignore this first line when copying to your child theme's functions.php file. | |
add_action( 'wp_footer', function() { ?> | |
<script type="text/javascript"> | |
// Convenience function to wrap multiple functions with timeouts. | |
function createFunctionWithTimeout(callback, optTimeout) { | |
let called = false; | |
function fn() { | |
if (!called) { |