-
AuthorPosts
-
June 13, 2019 at 7:15 pm #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
June 13, 2019 at 7:54 pm #1110037Hey 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 ShannonJune 13, 2019 at 8:57 pm #1110084Hi 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…June 13, 2019 at 9:00 pm #1110087I have just tryed to add import in quick css but It doesn’t work…
June 13, 2019 at 9:07 pm #1110092If possible, I’d prefer not to modify header.php (parent file)
Do you have another idea ?Regards
June 13, 2019 at 10:43 pm #1110136you 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
June 14, 2019 at 6:11 am #1110205Hi,
Thanks for sharing and for helping out @guenni007, did you try that out @ICEMAN?
Best regards,
RikardJune 14, 2019 at 5:00 pm #1110376Hello 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, 6 months ago by ICEMAN.
June 14, 2019 at 8:21 pm #1110471Hi ICEMAN,
Please have a look at the article here and at our docs:
https://www.hostinger.com/tutorials/how-to-create-wordpress-child-themeBest regards,
VictoriaJune 14, 2019 at 8:26 pm #1110476you 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. */
June 14, 2019 at 8:48 pm #1110493Ok, I understand. Thanks to all ! (Victoria, Rikard, Jordan and Guenni007)
Guenni007, the code below doesn’t workadd_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, 6 months ago by ICEMAN.
June 14, 2019 at 9:22 pm #1110507I 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
June 15, 2019 at 8:18 am #1110596Hi,
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,
RikardJune 17, 2019 at 2:46 pm #1111022Hi Rikard,
Thanks for your kindness, you can close this topic and thank you to all participants !!
RegardsJune 17, 2019 at 6:25 pm #1111086Hi,
I’m glad this was resolved. If you need additional help, please let us know here in the forums.
Best regards,
Jordan Shannon -
AuthorPosts
- The topic ‘google font doesn\'t work in my theme’ is closed to new replies.