Answer the question
In order to leave comments, you need to log in
How to install a different font in a Wordpress template?
Hello. Please help, I don't know how to change fonts in Wordpress template.
There is a template "ColorNews"
I created a new font in "Google Fonts"
Where to insert this line?
The template itself has the font “Roboto” - I found its mention in the wp-content\themes\colornews\inc\functions.php file
, it looks like this:
/**
* Enqueue scripts and styles.
*/
if ( !function_exists('colornews_fonts_url') ) {
// Using google font
// creating the function for adding the google font url
function colornews_fonts_url() {
$fonts_url = '';
$fonts = array();
$subsets = 'latin,latin-ext';
// applying the translators for the Google Fonts used
/* Translators: If there are characters in your language that are not
* supported by Roboto, translate this to 'off'. Do not translate
* into your own language.
*/
if ( 'off' !== _x( 'on', 'Roboto font: on or off', 'colornews' ) ) {
$fonts[] = 'Roboto:400,300,700,900';
}
// ready to enqueue Google Font
if ( $fonts ) {
$fonts_url = add_query_arg( array(
'family' => urlencode( implode( '|', $fonts ) ),
'subset' => urlencode( $subsets ),
), '//fonts.googleapis.com/css' );
}
return $fonts_url;
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question