Home Forums WoodMart support forum ow can I preload font-awesome ? Reply To: ow can I preload font-awesome ?

#127498

Artem Temos
Keymaster

Try to add the following PHP code snippet to the child theme functions.php file to do this

function add_rel_preload( $html, $handle, $href, $media ) {
	if ( is_admin() ) {
		return $html;
	}

	if ( 'font-awesome-css' === $handle || 'yith-wcwl-font-awesome' === $handle ) {
		return '<link rel="preload" id="' . $handle . '-css" href="' . $href . '" type="text/css" media="' . $media . '" />';

	}

	return $html;
}

add_filter( 'style_loader_tag', 'add_rel_preload', 10, 4 );