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 Async & Defer to certain scripts. | |
* | |
* @param string $tag Script Tags to display. | |
* @param string $handle Name of file specified above. | |
*/ | |
function add_async_defer_attribute( $tag, $handle ) { | |
$scripts = array( 'script-handle' ); | |
foreach ( $scripts as $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
/** | |
* Add Security Key and appropiate tags Enqueued Scripts & Styles. | |
* | |
* @param string $tag Script Tags to display. | |
* @param string $handle Name of file specified above. | |
*/ | |
function script_security_checks( $tag, $handle ) { | |
$scripts = array( 'script_handle' ); |
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
define( 'WP_DEBUG', true ); | |
if ( WP_DEBUG ) { | |
define( 'WP_DEBUG_LOG', true ); | |
define( 'WP_DEBUG_DISPLAY', false ); | |
define( 'SCRIPT_DEBUG', true ); | |
define( 'SAVEQUERIES', 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
/** | |
* Write to Debug Log | |
* | |
* Add to your functions.php file for use in a theme. | |
* Remember to remove from live environment. | |
* | |
* @param object $log | |
* @return void | |
*/ | |
if (!function_exists('write_log')) { |
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
/* | |
$original = '+44 (0)1234 567 890'; | |
$original = '0044 01234 567 890'; | |
$original = '01234 567 890'; | |
$original = '44 1234 567 890'; | |
Result should always be: +441234567890 | |
*/ | |
// Strip out all characters apart from numbers |