Tagged: Fonts, Google, google fonts, pagespeed
In working on improving my site’s performance, I’ve been trying to figure out how to move Enfold’s font loading out of the header section and into the footer. This is the solution that I came up with for my child theme, and I wanted to share it with everyone here. I wrote the following code and added it to my child theme’s functions.php
:
function fix_enfold_font_loading()
{
$style_generator = $GLOBALS['avia']->style;
remove_action("wp_head", array($style_generator, 'print_extra_output') ,5);
add_action("wp_footer", array($style_generator, 'print_extra_output') ,5);
}
add_filter('wp_head', 'fix_enfold_font_loading', 4);
I hope this helps somebody out!