D
D
Dim20172017-05-15 16:03:22
Fonts
Dim2017, 2017-05-15 16:03:22

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"
dfb1ba7879314be494405f3b9ec5dab6.jpg
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

1 answer(s)
R
Roman, 2017-05-15
@Dim2017

You don't need to insert a line.
In the above code, replace:
1. $subsets = 'latin,latin-ext';with
2. $fonts[] = 'Roboto:400,300,700,900';with
$fonts[] = 'Open+Sans:400,400i,700';

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question