Last active
June 1, 2023 01:26
-
-
Save mihdan/49920231aa202a88f2006c7e1c5d8260 to your computer and use it in GitHub Desktop.
Предзагрузка всех ссылок на странице при наведнии на них пользователем
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
<?php | |
/** | |
* instant.page | |
*/ | |
namespace Mihdan\App; | |
add_action( | |
'wp_enqueue_scripts', | |
function () { | |
wp_enqueue_script( 'instant.page', '//instant.page/5.1.0', [], null, true ); | |
} | |
); | |
add_filter( | |
'script_loader_tag', | |
function ( $tag, $handle ) { | |
if ( 'instant.page' !== $handle ) { | |
return $tag; | |
} | |
return str_replace( ' src', ' type="module" async="async" integrity="sha384-by67kQnR+pyfy8yWP4kPO12fHKRLHZPfEsiSXR8u2IKcTdxD805MGUXBzVPnkLHw" src', $tag ); | |
}, | |
10, | |
2 | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment