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) { |
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. | |
/** | |
* Make a shortcode for a popup's name (not the title) | |
* | |
* Note: The popup's internal name is actually the CPT's title. | |
* The internal name is different from the popup's title. | |
* | |
* The popup's title is optional. If you enter a popup title, | |
* it displays as the heading of your popup (external title). |
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 () { | |
// Only do for a post called Weekday Tabs just to avoid page bloat. Change to your | |
// post or page (is_page()) or remove this check if wanted. | |
if (!is_single('weekday-tabs')) return; ?> | |
<script> | |
(function() { | |
// Init some consts. | |
const weekDays = [ | |
"Monday", |
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> | |
(function () { | |
function testRestApi(url, cb) { | |
jQuery.ajax({ | |
url: url, | |
dataType: "text", | |
type: "GET", |