Viewing 16 posts - 1 through 16 (of 16 total)
  • Author
  • #1014731


    a question please to the google font integration in your theme. Because I have some trouble with fonts and want to optimize it.

    3 ways:
    1) Enfold Backend: Set a google font for headline / body = easy going (what about font weights…?)
    2) functions.php = coding*** but you can set the font weights
    3) slider revolution = also and additional integrate google fonts in the sliders

    What is the best way (performance & practice!) to integrate google fonts in enfold?
    What ways can I save?



    add_filter( 'avf_google_heading_font',  'avia_add_heading_font');
    function avia_add_heading_font($fonts)
    $fonts['Source Sans Pro'] = 'Source Sans Pro:400,600,800';
    return $fonts;
    add_filter( 'avf_google_content_font',  'avia_add_content_font');
    function avia_add_content_font($fonts)
    $fonts['Source Sans Pro'] = 'Source Sans Pro:400,600,800';
    return $fonts;

    Hey AWZ,

    Personally I’d recommend to use the child theme functions.php to add or modify the font data. However it’s not necessary to write two functions – you could compress it to:

    dd_filter( 'avf_google_heading_font', 'avia_add_custom_font');
    add_filter( 'avf_google_content_font', 'avia_add_custom_font');
    function avia_add_custom_font($fonts)
    $fonts['Source Sans Pro'] = 'Source Sans Pro:400,600,800';
    return $fonts;

    Best regards,



    I´ll reduce it. And what about the integration in the backend:
    Is this double activation then?
    Do I load all font weigths?




    Yes it will load all font files which you specify (i.e. 400,600,800 in the code sample above). In addition the code will overwrite the existing font data if the font name equals the name of an existing font – i.e. Source Sans Pro is included by default and your code overwrites the default font data.

    Is this double activation then?
    The code above just adds the font to the dropdown. You need to select the font from the dropdown and save the settings to actually “activate/use” it.

    Best regards,


    And: Google font offers only the integration via CSS. How is the code for example open sans?



    You can copy that and put it on the CSS Settings and it should work properly.

    Best regards,


    Thanks but we spoke about php not css. Could you tell me how to integrate for example open sans in functions.php
    Google has no datas for that.



    You will have to use the same filter above. Just change the name of the font or add it as a new font.

    add_filter( 'avf_google_heading_font', 'avia_add_custom_font');
    add_filter( 'avf_google_content_font', 'avia_add_custom_font');
    function avia_add_custom_font($fonts)
    $fonts['Open Sans New'] = 'Opens Sans:300,400,600,700,800';
    $fonts['Source Sans Pro'] = 'Source Sans Pro:400,600,800';
    return $fonts;

    Best regards,


    Thanks! I repeat the conclusion of this thread for a final understanding. Is this so correct?

    In the enfold backend you can choose the headline and body font. Websafe as well as several google fonts. For example Open Sans, Roboto etc. If you choose one, all font weights will be loaded?

    You can overwrite this preferences or add new google fonts with explicit font weights with the code above. For example if you want Titillium, Roboto Slab etc.

    The correct spelling of the font family is like this:
    $fonts['Roboto Slab'] = 'Roboto Slab: 300,400,700'>

    Not like this:
    $fonts['Roboto+Slab'] = 'Roboto+Slab: 300,400,700'>

    PS. And Open Sans without New?
    $fonts['Open Sans New'] = 'Opens Sans:300,400,600,700,800';

    BG Sven



    Yes! The default font values are defined in enfold/framework/php/font-management/class-avia-type-fonts.php:

    		$fonts = array(
    						'Advent Pro'		=> 'Advent Pro:100,400,600',
    						'Alice'				=> 'Alice',
    						'Allerta'			=> 'Allerta',
    						'Arvo'				=> 'Arvo',
    						'Arimo'				=> 'Arimo:400,700',
    						'Antic'				=> 'Antic',
    						'Audiowide'			=> 'Audiowide',
    						'Bad Script'		=> 'Bad Script',
    						'Baumans'			=> 'Baumans',
    						'Bangers'			=> 'Bangers',
    						'Barlow'			=> 'Barlow:400,500,600,700',
    						'Bitter'			=> 'Bitter',
    						'Cabin'				=> 'Cabin',
    						'Cardo'				=> 'Cardo',
    						'Carme'				=> 'Carme',
    						'Caveat'			=> 'Caveat:400,700',
    						'Coda'				=> 'Coda',
    						'Codystar'			=> 'Codystar:300,400',
    						'Cormorant Garamond'	=> 'Cormorant Garamond:300,400,700',
    						'Comfortaa'			=> 'Comfortaa:300,400,700',
    						'Coustard'			=> 'Coustard',
    						'Gruppo'			=> 'Gruppo',
    						'Damion'			=> 'Damion',
    						'Dancing Script'	=> 'Dancing Script',
    						'Droid Sans'		=> 'Droid Sans',
    						'Droid Serif'		=> 'Droid Serif',
    						'EB Garamond'		=> 'EB Garamond',
    						'Exo'				=> 'Exo:900,700,400,100',
    						'Finger Paint'		=> 'Finger Paint',
    						'Fira Sans'			=> 'Fira Sans:100,400,700',
    						'Fjord One'			=> 'Fjord One',
    						'Flamenco'			=> 'Flamenco:400,300',
    						'Great Vibes'		=> 'Great Vibes',
    						'Heebo'				=> 'Heebo:100,400,700',
    						'Herr Von Muellerhoff'	=> 'Herr Von Muellerhoff',
    						'IBM Plex Serif'	=> 'IBM Plex Serif:300,400,700',
    						'Inconsolata'		=> 'Inconsolata',
    						'Josefin Sans'		=> 'Josefin Sans',
    						'Josefin Slab'		=> 'Josefin Slab',
    						'Kameron'			=> 'Kameron',
    						'Karla'				=> 'Karla:400,700',
    						'Kreon'				=> 'Kreon',
    						'Lato'				=> 'Lato:300,400,700',
    						'Lobster'			=> 'Lobster',
    						'Lora'				=> 'Lora',
    						'League Script'		=> 'League Script',
    						'Mate SC'			=> 'Mate SC',
    						'Marck Script'		=> 'Marck Script',
    						'Mako'				=> 'Mako',
    						'Megrim'			=> 'Megrim',
    						'Merienda'			=> 'Merienda:400,700',
    						'Merriweather'		=> 'Merriweather:300,400,700',
    						'Metrophobic'		=> 'Metrophobic',
    						'Molengo'			=> 'Molengo',
    						'Montserrat'		=> 'Montserrat',
    						'Muli'				=> 'Muli',
    						'Nixie One'			=> 'Nixie One',
    						'Nobile'			=> 'Nobile',
    						'News Cycle'		=> 'News Cycle',
    						'Open Sans'			=> 'Open Sans:400,600',
    						'Open Sans Condensed'	=> 'Open Sans Condensed:300,700',
    						'Orbitron'			=> 'Orbitron',
    						'Oregano'			=> 'Oregano',
    						'Oswald'			=> 'Oswald',
    						'Pacifico'			=> 'Pacifico',
    						'Parisienne'		=> 'Parisienne',
    						'Petit Formal Script'	=> 'Petit Formal Script',
    						'Pinyon Script'		=> 'Pinyon Script',
    						'Playfair Display'	=> 'Playfair Display:400,700',
    						'Podkova'			=> 'Podkova',
    						'Poiret One'		=> 'Poiret One',
    						'Poly'				=> 'Poly',
    						'Press Start 2P (Retro Pixelfont)'	=> 'Press Start 2P',
    						'PT Sans'			=> 'PT Sans',
    						'Quattrocento'		=> 'Quattrocento',
    						'Questrial'			=> 'Questrial',
    						'Quicksand'			=> 'Quicksand',
    						'Raleway'			=> 'Raleway',
    						'Righteous'			=> 'Righteous',
    						'Roboto'			=> 'Roboto:100,400,700',
    						'Sacramento'		=> 'Sacramento',
    						'Salsa'				=> 'Salsa',
    						'Signika Negative'	=> 'Signika Negative',
    						'Source Serif Pro'	=> 'Source Serif Pro:400,600,700',
    						'Sunshiney'			=> 'Sunshiney',
    						'Special Elite'		=> 'Special Elite',
    						'Tangerine'			=> 'Tangerine',
    						'Terminal Dosis'	=> 'Terminal Dosis',
    						'Tenor Sans'		=> 'Tenor Sans',
    						'Varela Round'		=> 'Varela Round',
    						'Work Sans'			=> 'Work Sans:700,400,100',
    						'Yellowtail'		=> 'Yellowtail',

    Best regards,


    Cool. SOLVED


    Hi AWZ,

    Glad we could help :)

    If you need further assistance please let us know.
    Best regards,


    Hello Support,

    I would like to activate Montserrat Bold (600, 800) because Montserrat could not be the bold style on Chrome and Firefox of Mac OS).

    I put the following code on function.php but still could not load it.

    add_filter( 'avf_google_heading_font', 'avia_add_custom_font');
    add_filter( 'avf_google_content_font', 'avia_add_custom_font');
    function avia_add_custom_font($fonts)
    $fonts['Montserrat'] = 'Montserrat:300,600,800';
    return $fonts;

    Can I have any advice?



    Are you trying to set it as a body font? Replace the filter with the following code.

    add_filter( 'avf_google_heading_font', 'avia_add_custom_heading_font');
    add_filter( 'avf_google_content_font', 'avia_add_custom_body_font');
    function avia_add_custom_heading_font($fonts)
    $fonts['Montserrat New'] = 'Montserrat:300,600,800';
    return $fonts;
    function avia_add_custom_body_font($fonts)
    $fonts['Google fonts']['Montserrat New'] = 'Montserrat:300,600,800';
    return $fonts;

    Select the “Montserrat New” in the fonts panel. You may need to specify the font weight with css manually.

    Best regards,


    Thank you so much. It has worked immediately. Have a good one!



    Cool. We’ll close the thread now. Have a nice day.

    Best regards,

Viewing 16 posts - 1 through 16 (of 16 total)

The topic ‘Google Fonts’ is closed to new replies.