Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1412688

    meir d
    Participant

    hi,

    i use face fonts for displaying Hebrew text.

    in some pages i need to display text in English. i want to use “Lato” font that comes with your theme.

    how can i set it to display lato whenever English is Used?

    this is the site’s URL: http://www.danon.org.il (ex: http://www.danon.org.il/syindia/)

    Thanks, Meir

    #1413200

    Rue Nel
    Moderator

    Hello Meir,

    Thanks for writing in! To resolve your issue, since you already have your child theme active and ready, please insert this following code in your child theme’s functions.php file.

    // Change font stack if English
    // =============================================================================
    function change_font_stack($lang){
      if ( get_locale() != 'he_IL') {
        $lang = 'Arial';
      }
      var_dump($lang);
      return $lang;
    }
    add_filter('x_option_x_body_font_family', 'change_font_stack');
    add_filter('x_option_x_headings_font_family', 'change_font_stack');
    // =============================================================================

    We would loved to know if this has work for you. Thank you.

    #1413305

    meir d
    Participant

    hi,

    thanks, It doesn’t seem to do anything…

    thanks again, Meir

    #1413601

    Jade
    Moderator

    Hi Meir,

    Please try to update the code to:

    // Change font stack if English
    // =============================================================================
    function change_font_stack($lang){
      if ( get_locale() != 'he_IL') {
        $lang = 'Lato';
      }
      var_dump($lang);
      return $lang;
    }
    add_filter('x_option_x_body_font_family', 'change_font_stack');
    add_filter('x_option_x_headings_font_family', 'change_font_stack');
    
    // =============================================================================
    
    add_action( 'wp_enqueue_scripts', 'gf_scripts' ); 
     
    function gf_scripts() {	
    
    	wp_enqueue_style( 'gf-google-font', 'https://fonts.googleapis.com/css?family=Lato' );
    }

    Hope this helps.

    #1413886

    meir d
    Participant

    Sorry Jade, Still doesn’t work 🙁

    #1414084

    Nabeel A
    Moderator

    Hi again,

    Please try updating the previous code with the following code:

    // Change font stack if English
    // =============================================================================
    function change_font_stack($lang){
      if ( get_locale() != 'he_IL') {
        $lang = 'Lato';
      }
      var_dump($lang);
      return $lang;
    }
    add_filter('x_option_x_body_font_family', 'change_font_stack');
    add_filter('x_option_x_headings_font_family', 'change_font_stack');
    
    // =============================================================================
    
    add_action( 'wp_head', 'gf_scripts' ); 
    function gf_scripts() {	
            <link href="https://fonts.googleapis.com/css?family=Lato" rel="stylesheet" type="text/css">
    }

    Let us know how this goes!