Archived topic
Multiple local fonts - only one works
6 replies · Started by Kommunikationsbeauftragter on July 4, 2018
Hi,
Im trying to get multiple fonts to work for hours now. The problem I have, is that if I add multiple local fonts the way described here: https://generatepress.com/forums/topic/custom-fonts-how-to-add-multiple-fonts-and-how-to-limit-the-weights/
only the first font declared in my functions.php works.
<?php
/**
* GeneratePress child theme functions and definitions.
*
* Add your custom PHP in this file.
* Only edit this file if you have direct access to it on your server (to fix errors if they happen).
*/
function generatepress_child_enqueue_scripts() {
if ( is_rtl() ) {
wp_enqueue_style( 'generatepress-rtl', trailingslashit( get_template_directory_uri() ) . 'rtl.css' );
}
}
add_filter( 'generate_typography_default_fonts','tu_add_system_fonts' );
function tu_add_system_fonts( $fonts ) {
$fonts[] = 'Lato'; /*only this one ist working*/
$fonts[] = 'Reem Kufi';
return $fonts;
}
They both show up in the typography system fonts dropdown menu, but the second one (reem kufi) doesnt changes the texts look to times new roman. If I change their order in the php(so reem kufi is declared first and then lato) reem kufi works, but the lato font stops to work. Thats why i think there is a problem in my php and not in my css.
Greetings from Germany
Elias
Can't anyone help me?
Hi there,
Can you share the @font-face CSS that you're using as well?
You can find updated docs here: https://docs.generatepress.com/article/adding-local-fonts/
Of course :)
(edit: ive deleted it because it was pointing to sort of an official website. I had a typo in the url pointing to the font)
This is my css. I have tried it both through the Simple CSS plugin and the child themes style.css. With none of them both fonts worked...
(Thanks for sharing the documentation. I followed every step of it (before post 1) but I can' get both fonts to work at the same time)
Can you confirm that the URL to the files are correct? I'm seeing these console errors on your website: https://www.screencast.com/t/1JFU4LzX1d
Thanks for your help! It was just a simple typo in the URL (wp_content instead of wp-content and a missing /themes inside...)
Elias
Glad I could help! :)