Register custom fonts
/** * Register custom fonts. */ function themeslug_fonts_url() { $fonts_url = ''; $fonts = array(); $subsets = 'latin,latin-ext'; /* * Translators: If there are characters in your language that are not supported * by Oswald, translate this to 'off'. Do not translate into your own language. */ if ( 'off' !== _x( 'on', 'Oswald font: on or off', 'themeslug' ) ) { $fonts[] = 'Oswald:400,700'; } /* * Translators: If there are characters in your language that are not supported * by Montserrat, translate this to 'off'. Do not translate into your own language. */ if ( 'off' !== _x( 'on', 'Montserrat font: on or off', 'themeslug' ) ) { $fonts[] = 'Montserrat:400,700'; } if ( $fonts ) { $fonts_url = add_query_arg( array( 'family' => urlencode( implode( '|', $fonts ) ), 'subset' => urlencode( $subsets ), ), 'https://fonts.googleapis.com/css' ); } return esc_url_raw( $fonts_url ); }