Skip to content

Instantly share code, notes, and snippets.

@mihdan
Last active June 16, 2020 11:56
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mihdan/31cd22e86cab489b92ceab49a08661bd to your computer and use it in GitHub Desktop.
Save mihdan/31cd22e86cab489b92ceab49a08661bd to your computer and use it in GitHub Desktop.
<?php
/**
* Добавляем свой шрифт в тему асинхронно
*
* @link https://github.com/typekit/webfontloader
*/
function mihdan_add_roboto_font() {
?>
<script type="text/javascript">
WebFontConfig = {
classes: false,
events: false,
google: {
families: [ 'Roboto:400,700:cyrillic&display=swap' ]
}
};
(function( d ) {
var wf = d.createElement('script'),
s = d.getElementsByTagName('script')[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>
<?php
}
add_action( 'wp_head', 'mihdan_add_roboto_font' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment