This file contains 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
<!-- Add the following before </head> --> | |
<script> | |
( function () { | |
window.onpageshow = function( event ) { | |
if ( event.persisted ) { | |
window.location.reload(); | |
} | |
}; | |
} )(); | |
</script> |
This file contains 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
/** | |
* Include responsive image | |
* @param array $aImageScope The image settings | |
* @param array $aClasses Apply classes to the image (optional) | |
* API Reference: https://ewww.io/exactdn-api/ | |
* @example: | |
* $aImage = [ | |
* 'image_url' => 'https://assets.imgix.net/examples/treefrog.jpg', | |
* 'alt' => 'Alternative text', | |
* 'picture_tag' => true, |
This file contains 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
/* Spinner */ | |
.gform_ajax_spinner { | |
margin-left: 20px; | |
border: 4px solid rgba(255, 255, 255, 0.3); | |
border-left: 4px solid rgba(110, 73, 217, 0.7); | |
animation: spinner 1.1s infinite linear; | |
border-radius: 50%; | |
width: 30px; | |
height: 30px; | |
} |
This file contains 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 if member is locked out by Defender (add to /wp-content/mu-plugins/ | |
add_filter( 'ip_lockout_default_whitelist_ip', function ( $ips ) { | |
$ip = 'YOUR IP HERE'; | |
$ips[] = $ip; | |
return $ips; | |
} ); |
This file contains 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
/************** | |
* Prepend all anchors with preserved GET parameters | |
**************/ | |
( function() { | |
var domainsToDecorate = [ | |
'domain1.com', // add or remove domains (without https or trailing slash) | |
'domain2.net' | |
], | |
queryParams = [ |
This file contains 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
/************** | |
* Force menu pop-up to be 100vh (to get around Chrome/iOS bar) | |
**************/ | |
$( window ).on( 'load', fnRealWindowHeight ); | |
$( window ).on( 'resize', fnRealWindowHeight ); | |
// Test....... | |
$( window ).on( 'load resize', fnRealWindowHeight ); | |
function fnRealWindowHeight() { |
This file contains 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
function cAccordions( i, oComp ) { | |
var oComp = $( oComp ); | |
var oAccordions = $( '.c_accordion', oComp ); | |
/*************** | |
* Accordions | |
***************/ | |
$( '.accordion_head', oAccordions ).on( 'click', function() { |
This file contains 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
function fnCustomAwardEditTableCol( $aColumns ) { | |
$aColumns = [ | |
'cb' => '<input type="checkbox" />', | |
'title' => 'Title', | |
'certificate' => 'Certificate', | |
'award_body' => 'Awarding Body' | |
]; | |
return $aColumns; |
This file contains 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
/******************************************************************************/ | |
/* Automatically adding the product to the cart. | |
/* https://www.tychesoftwares.com/how-to-automatically-add-a-product-to-your-woocommerce-cart-in-3-different-scenarios/ | |
/******************************************************************************/ | |
function auto_add_product_to_cart() { | |
if ( ! is_admin() ) { | |
$product_id = 2623; // Product ID which will get added to cart. Should be dynamic. |
This file contains 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
if (matchMedia) { | |
const mq = window.matchMedia("(min-width: 800px)"); | |
mq.addListener(WidthChange); | |
WidthChange(mq); | |
} | |
// media query change | |
function WidthChange(mq) { | |
if (mq.matches) { | |
console.log( 'window width is at least 800px' ); |
NewerOlder