Comments 8ynskdemir started the conversationSeptember 10, 2019 at 9:55amHi, I want to preload this asset. Because it causes speed problem. Can you help?[deleted] repliedSeptember 11, 2019 at 8:00amHi, The font is included in: assets/js/slick/slick-theme.css:16 So the code to preload the font file is this: add_action( 'wp_head', function() { printf( '<link rel="preload" href="%s" as="font">', esc_attr( get_template_directory_uri() . '/assets/js/slick/fonts/slick.woff' ) ); }, 1 ); 8ynskdemir repliedSeptember 11, 2019 at 1:35pmIf I place this code am I able to preload it? Where should I place this code? [deleted] repliedSeptember 12, 2019 at 7:32amHi,The code should be added in functions.php (end of file). I have modified to fix few missing attributes: add_action( 'wp_head', function() { printf( '<link rel="preload" href="%s" as="font" type="font/woff" crossorigin>', esc_attr( get_template_directory_uri() . '/assets/js/slick/fonts/slick.woff' ) ); }, 1 );The browser will preload it automatically based on your question this is how preloading font works. 8ynskdemir repliedSeptember 14, 2019 at 10:17amThank you a lot :) It was very helpful Sign in to reply ...
Hi, I want to preload this asset. Because it causes speed problem. Can you help?
Hi,
The font is included in:
So the code to preload the font file is this:
If I place this code am I able to preload it?
Where should I place this code?
Hi,
The code should be added in functions.php (end of file). I have modified to fix few missing attributes:
The browser will preload it automatically based on your question this is how preloading font works.
Thank you a lot :) It was very helpful