catchresponsive_fonts_url

Return the Google font stylesheet URL, if available.

Description

(string) catchresponsive_fonts_url(); 

The use of Open Sans and Droid Sans by default is localized. For languages that use characters not supported by the font, the font can be disabled.

Returns (string)

Font stylesheet or empty string if disabled.


Usage

  1. if ( !function_exists( 'catchresponsive_fonts_url' ) ) { 
  2. require_once '/inc/catchresponsive-core.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = catchresponsive_fonts_url(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/inc/catchresponsive-core.php  
  1. function catchresponsive_fonts_url() { 
  2. $fonts_url = ''; 
  3.  
  4. /** Translators: If there are characters in your language that are not 
  5. * supported by Open Sans, translate this to 'off'. Do not translate 
  6. * into your own language. 
  7. */ 
  8. $open_sans = _x( 'on', 'Open Sans font: on or off', 'catch-responsive' ); 
  9.  
  10. /** Translators: If there are characters in your language that are not 
  11. * supported by Droid Sans, translate this to 'off'. Do not translate into your 
  12. * own language. 
  13. */ 
  14. $droid_sans = _x( 'on', 'Droid Sans font: on or off', 'catch-responsive' ); 
  15.  
  16. if ( 'off' !== $open_sans || 'off' !== $droid_sans ) { 
  17. $font_families = array(); 
  18.  
  19. if ( 'off' !== $open_sans ) 
  20. $font_families[] = 'Open Sans:300, 400, 700, 300italic, 400italic, 700italic'; 
  21.  
  22. if ( 'off' !== $droid_sans ) 
  23. $font_families[] = 'Droid Sans:400, 700'; 
  24.  
  25. $query_args = array( 
  26. 'family' => urlencode( implode( '|', $font_families ) ),  
  27. 'subset' => urlencode( 'latin, latin-ext' ),  
  28. ); 
  29. $fonts_url = add_query_arg( $query_args, "//fonts.googleapis.com/css" ); 
  30.  
  31. return $fonts_url;