Skip to content

Instantly share code, notes, and snippets.

@Nikschavan
Created August 10, 2018 14:31
Show Gist options
  • Save Nikschavan/92bfd7f95ca882f2cce91c1877751d9c to your computer and use it in GitHub Desktop.
Save Nikschavan/92bfd7f95ca882f2cce91c1877751d9c to your computer and use it in GitHub Desktop.
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