Create a gist now

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Load Extra font variants in Astra Google Fonts.
<?php // don't copy this line in your code
/**
* Load extra font weights in Astra Google fonts.
* This example loads extra variannts for the Open Sans font.
*
* @param Array $fonts Fonts selected in customizer.
* @return Array Fonts array updated with more font variants to be loaded.
*/
function your_prefix_astra_more_font_weights( $fonts ) {
if ( isset( $fonts["'Open Sans', sans-serif"] ) ) {
$fonts["'Open Sans', sans-serif"] = array( '400', '400i', '700', '700i' );
}
return $fonts;
}
add_filter( 'astra_google_fonts', 'your_prefix_astra_more_font_weights' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment