Skip to content

Commit 92f1ea1

Browse files
committed
Use gettext to conditionally load webfonts
1 parent 573da9e commit 92f1ea1

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

functions.php

+17-1
Original file line numberDiff line numberDiff line change
@@ -124,13 +124,29 @@ function elucidate_widgets_init() {
124124
}
125125
add_action( 'widgets_init', 'elucidate_widgets_init' );
126126

127+
/**
128+
* Returns the url to the Lato web font stylesheet
129+
*/
130+
function elucidate_font_url() {
131+
$font_url = '';
132+
/*
133+
* Translators: If there are characters in your language that are not supported
134+
* by Lato, translate this to 'off'. Do not translate into your own language.
135+
*/
136+
if ( 'off' !== _x( 'on', 'Lato font: on or off', 'elucidate' ) ) {
137+
$font_url = add_query_arg( 'family', urlencode( 'Lato:300,400,700,400italic,700italic' ), "//fonts.googleapis.com/css" );
138+
}
139+
140+
return $font_url;
141+
}
142+
127143
/**
128144
* Enqueue scripts and styles
129145
*/
130146
function elucidate_scripts() {
131147
wp_enqueue_style( 'elucidate-style', get_stylesheet_uri() );
132148

133-
wp_enqueue_style ( 'lato-webfont', 'http://fonts.googleapis.com/css?family=Lato:300,400,700,400italic,700italic' );
149+
wp_enqueue_style ( 'lato-webfont', elucidate_font_url() );
134150

135151
wp_enqueue_script( 'elucidate-navigation', get_template_directory_uri() . '/js/navigation.js', array(), '20120206', true );
136152

0 commit comments

Comments
 (0)