I usually try to avoid Google products, especially when it comes to web tracking, although I’m a big fan of what they do in other technologies.
Today I was testing another WordPress Theme called Fluida, a free theme from Cryout Creations. It’s clean and simple, the only thing that bothers me, is the usage of the Google Fonts API. Even if you don’t enter a Google Font in the settings, it’s connecting to the API.
Google Fonts has advantages as well as disadvantages. Read more about it here.
There are a few WordPress plugins to remove Google Fonts (e.g. Autoptimize), but I tried to avoid another plugin and wanted to do it manually. After a short search through the theme I found “includes/styles.php”. There you just had to comment out the following lines and it’s done.
// Google fonts
$gfonts = array();
$roots = array();
foreach ( $cryout_theme_structure['google-font-enabled-fields'] as $item ) {
$itemg = $item . 'google';
$itemw = $item . 'weight';
// custom font names
if ( ! empty( $options[$itemg] ) && ! preg_match( '/custom\sfont/i', $options[$item] ) ) {
if ( $item == _CRYOUT_THEME_PREFIX . '_fgeneral' ) {
$gfonts[] = cryout_gfontclean( $options[$itemg], ":100,200,300,400,500,600,700,800,900" ); // include all weights for general font
} else {
$gfonts[] = cryout_gfontclean( $options[$itemg], ":".$options[$itemw] );
};
$roots[] = cryout_gfontclean( $options[$itemg] );
}
// preset google fonts
if ( preg_match('/^(.*)\/gfont$/i', $options[$item], $bits ) ) {
if ( $item == _CRYOUT_THEME_PREFIX . '_fgeneral' ) {
$gfonts[] = cryout_gfontclean( $bits[1], ":100,200,300,400,500,600,700,800,900" ); // include all weights for general font
} else {
$gfonts[] = cryout_gfontclean( $bits[1], ":".$options[$itemw] );
};
$roots[] = cryout_gfontclean( $bits[1] );
}
};