twentyfifteen_fonts_url

Register Google fonts for Twenty Fifteen.

Description

(string) twentyfifteen_fonts_url(); 

Returns (string)

Google fonts URL for the theme.


Usage

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

Defined (1)

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

/functions.php  
  1. function twentyfifteen_fonts_url() { 
  2. $fonts_url = ''; 
  3. $fonts = array(); 
  4. $subsets = 'latin, latin-ext'; 
  5.  
  6. /** 
  7. * Translators: If there are characters in your language that are not supported 
  8. * by Noto Sans, translate this to 'off'. Do not translate into your own language. 
  9. */ 
  10. if ( 'off' !== _x( 'on', 'Noto Sans font: on or off', 'twentyfifteen' ) ) { 
  11. $fonts[] = 'Noto Sans:400italic, 700italic, 400, 700'; 
  12.  
  13. /** 
  14. * Translators: If there are characters in your language that are not supported 
  15. * by Noto Serif, translate this to 'off'. Do not translate into your own language. 
  16. */ 
  17. if ( 'off' !== _x( 'on', 'Noto Serif font: on or off', 'twentyfifteen' ) ) { 
  18. $fonts[] = 'Noto Serif:400italic, 700italic, 400, 700'; 
  19.  
  20. /** 
  21. * Translators: If there are characters in your language that are not supported 
  22. * by Inconsolata, translate this to 'off'. Do not translate into your own language. 
  23. */ 
  24. if ( 'off' !== _x( 'on', 'Inconsolata font: on or off', 'twentyfifteen' ) ) { 
  25. $fonts[] = 'Inconsolata:400, 700'; 
  26.  
  27. /** 
  28. * Translators: To add an additional character subset specific to your language,  
  29. * translate this to 'greek', 'cyrillic', 'devanagari' or 'vietnamese'. Do not translate into your own language. 
  30. */ 
  31. $subset = _x( 'no-subset', 'Add new subset (greek, cyrillic, devanagari, vietnamese)', 'twentyfifteen' ); 
  32.  
  33. if ( 'cyrillic' == $subset ) { 
  34. $subsets .= ', cyrillic, cyrillic-ext'; 
  35. } elseif ( 'greek' == $subset ) { 
  36. $subsets .= ', greek, greek-ext'; 
  37. } elseif ( 'devanagari' == $subset ) { 
  38. $subsets .= ', devanagari'; 
  39. } elseif ( 'vietnamese' == $subset ) { 
  40. $subsets .= ', vietnamese'; 
  41.  
  42. if ( $fonts ) { 
  43. $fonts_url = add_query_arg( array( 
  44. 'family' => urlencode( implode( '|', $fonts ) ),  
  45. 'subset' => urlencode( $subsets ),  
  46. ), 'https://fonts.googleapis.com/css' ); 
  47.  
  48. return $fonts_url;