Viewing 15 posts - 1 through 15 (of 15 total)
  • Author
    Posts
  • #1109990

    Hello everybody, I try to use this font : @import url(‘https://fonts.googleapis.com/css?family=Amatic+SC&display=swap’);

    I insert this code in my css and call It by “font-family: ‘Amatic SC’, cursive” in the editor but It doesn’t work correctly.

    On display, the font is replaced by another one.

    Look at my page in private link

    #1110037

    Hey ICEMAN,

    Did you add the import to the very top of quick css so it runs first?
    Also, perhaps try adding the Google Font link tags within the header.php file to link to the font.

    Best regards,
    Jordan Shannon

    #1110084

    Hi Jordan,
    Thanks for your answer. No, I add the import in my style.css. I already have other imports in this file and It works well…

    #1110087

    I have just tryed to add import in quick css but It doesn’t work…

    #1110092

    If possible, I’d prefer not to modify header.php (parent file)
    Do you have another idea ?

    Regards

    #1110136

    you can add the link definition as it is presented at google fonts to the head section by child-theme functions.php via:

    add_action('wp_head', function() {
    ?>
      <link href='https://fonts.googleapis.com/css?family=Amatic+SC&display=swap' rel='stylesheet' type='text/css'>
    <?php
    });

    PS: on GDPR (DSGVO) Reasons – i load the font localy – and this works good

    #1110205

    Hi,

    Thanks for sharing and for helping out @guenni007, did you try that out @ICEMAN?

    Best regards,
    Rikard

    #1110376

    Hello Guys,

    when i create a function.php in my child theme, my site does not work anymore. I am a novice. Does my function.php file of my child theme need to have any other syntax?

    • This reply was modified 5 years, 5 months ago by ICEMAN.
    #1110471

    Hi ICEMAN,

    Please have a look at the article here and at our docs:
    https://www.hostinger.com/tutorials/how-to-create-wordpress-child-theme

    Best regards,
    Victoria

    #1110476

    you are working with a child-theme – but have no functions.php in there?
    The downloadable preset child-theme of Enfold has it on default: https://kriesi.at/documentation/enfold/child-theme/

    And this is all what is in the starting child-theme functions.php

    <?php
    
    /*
    * Add your own functions here. You can also copy some of the theme functions into this file. 
    * WordPress will use those functions instead of the original functions then.
    */
    #1110493

    Ok, I understand. Thanks to all ! (Victoria, Rikard, Jordan and Guenni007)
    Guenni007, the code below doesn’t work

    add_action('wp_head', function() {
    ?>
      <link href='https://fonts.googleapis.com/css?family=Amatic+SC&display=swap' rel='stylesheet' type='text/css'>
    <?php
    });
    • This reply was modified 5 years, 5 months ago by ICEMAN.
    #1110507

    I just found the solution.

    I add this code in my child theme header.php like Jordan suggest me before and It works now.

    <meta charset="<?php bloginfo( 'charset' ); ?>">
    	<meta name="viewport" content="width=device-width, initial-scale=1">
    	<link rel="profile" href="http://gmpg.org/xfn/11">
    
    	<link href="https://fonts.googleapis.com/css?family=Amatic+SC&display=swap" rel="stylesheet">
    
    	<?php wp_head(); ?>

    So thank you Jordan and thanks to everyone for your help and your advice !

    Regards

    #1110596

    Hi,

    Great, I’m glad that you found a solution and thanks for sharing. Please let us know if you should need any further help on the topic or if we can close it.

    Best regards,
    Rikard

    #1111022

    Hi Rikard,
    Thanks for your kindness, you can close this topic and thank you to all participants !!
    Regards

    #1111086

    Hi,

    I’m glad this was resolved. If you need additional help, please let us know here in the forums.

    Best regards,
    Jordan Shannon

Viewing 15 posts - 1 through 15 (of 15 total)
  • The topic ‘google font doesn\'t work in my theme’ is closed to new replies.