Created
June 28, 2017 14:49
-
-
Save slobich/82fa9aa9fa61c717711b0278526390f1 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
function lilashpros_load_head_scripts() { | |
// Check if JavaScript is enabled | |
// https://www.paulirish.com/2009/avoiding-the-fouc-v3/ | |
echo '<script>(function(H){H.className=H.className.replace(/\bno-js\b/,\'js\')})(document.documentElement)</script>'; | |
// Font loader | |
// Add wf-loading class and hide body as soon as possible | |
echo '<script>document.documentElement.className+=\' wf-loading\'</script>'; | |
echo '<style>.wf-loading{opacity:0;}</style>'; | |
// Load font loader script | |
echo "<script> | |
WebFontConfig = { | |
google: { | |
families: ['Lato:400,400italic,700,700italic:latin-ext'] | |
}, | |
}; | |
(function(d) { | |
var wf = d.createElement('script'), s = d.scripts[0]; | |
wf.src = 'https://ajax.googleapis.com/ajax/libs/webfont/1.6.26/webfont.js'; | |
wf.async = true; | |
s.parentNode.insertBefore(wf, s); | |
})(document); | |
</script>"; | |
} | |
add_action('wp_head', 'lilashpros_load_head_scripts', 1); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment