-
Rachel
so I am trying to load 2 fonts norwester and kollektif I have add a folder to my child theme with the font files and then added the css in the customizer ( would really like to added it to the child theme instead but it seems to only work when its in the customizer could be part of my issue?) The norwester one is loading correctly on the home page but not on any other page ( just want the primary menu to be in this font the other kollektif I don’t know what I am doing wrong but its not loading at all.
This is the code I am adding:
@font-face {
font-family: ‘norwester’;
src: url(‘wp-content/themes/Vccid Theme/fonts/Vccid-heading-font/vccid-heading-font-webfont.woff2’) format(‘woff2’),
url(‘wp-content/themes/Vccid Theme/fonts/Vccid-heading-font/vccid-heading-font-webfont.woff’) format(‘woff’),
url(‘wp-content/themes/Vccid Theme/fonts/Vccid-heading-font/vccid-heading-font-webfont.ttf’) format(‘truetype’),
url(‘wp-content/themes/Vccid Theme/fonts/Vccid-heading-font/vccid-heading-font-webfont.svg#norwesterregular’) format(‘svg’);
font-weight: normal;
font-style: normal;}
@font-face {
font-family: ‘kollektif’;
src: url(‘wp-content/themes/Vccid Theme/fonts/Vccid-body-font/kollektif-webfont.woff2’) format(‘woff2’),
url(‘wp-content/themes/Vccid Theme/fonts/Vccid-body-font/kollektif-webfont.woff’) format(‘woff’),
url(‘wp-content/themes/Vccid Theme/fonts/Vccid-body-font/kollektif-webfont.ttf’) format(‘truetype’),
url(‘wp-content/themes/Vccid Theme/fonts/Vccid-body-font/kollektif-webfont.svg#kollektifregular’) format(‘svg’);
font-weight: normal;
font-style: normal;
}and then in my functions file I have added this:
add_filter( ‘generate_typography_default_fonts’, function(
$fonts ) {
$fonts[] = ‘norwester’;
return $fonts;
} );add_filter( ‘generate_typography_default_fonts’, function(
$fonts ) {
$fonts[] = ‘kollektif’;
return $fonts;
} ); -
Fernando
Hi there,
Try adding the full font link.
Example:
https://www.YOUR-SITE.COM/wp-content/themes/Vccid Theme/fonts/Vccid-body-font/kollektif-webfont.svg#kollektifregular
-
This is what I added (just decided to first get the 1 font working) now its no longer even showing up on the homepage primary navigation
@font-face {
font-family: ‘norwester’;
src: url(‘https://www.vccid.org/wp-content/themes/Vccid Theme/fonts/Vccid-heading-font.woff2’) format(‘woff2’),
url(‘https://www.vccid.org/wp-content/themes/Vccid Theme/fonts/Vccid-heading-font.woff’) format(‘woff’),
url(‘https://www.vccid.org/wp-content/themes/Vccid Theme/fonts/Vccid-heading-font.ttf’) format(‘truetype’),
url(‘https://www.vccid.org/wp-content/themes/Vccid Theme/fonts/Vccid-heading-font.svg#norwesterregular’) format(‘svg’);
font-weight: normal;
font-style: normal;}
-
Fernando
Those font links you added don’t seem correct. There shouldn’t be any space in a link.
Could you double-check?
-
okay sorry about that, this is the updated code but its still not working right unfortunately
@font-face {
font-family: ‘norwester’;
src: url(‘public_html/vccid.org/wp-content/themes/Vccid-Theme/fonts/Vccid-heading-font.woff2’) format(‘woff2’),
url(‘public_html/vccid.org/wp-content/themes/Vccid-Theme/fonts/Vccid-heading-font.woff’) format(‘woff’),
url(‘public_html/vccid.org/wp-content/themes/Vccid-Theme/fonts/Vccid-heading-font.ttf’) format(‘truetype’),
url(‘public_html/vccid.org/wp-content/themes/Vccid-Theme/fonts/Vccid-heading-font.svg#norwesterregular’) format(‘svg’);
font-weight: normal;
font-style: normal; -
Fernando
If you go to this – public_html/vccid.org/wp-content/themes/Vccid-Theme/fonts/Vccid-heading-font.woff2 – is the font downloaded by the browser?
-
Yes
-
Fernando
I see. Could you try viewing the site on a different browser?
Moreover, it’s difficult to assess the issue without seeing it live. Would you be able to host the site on a staging version?
-
Rachel
okay got the staging site up hopefully that will help you guys tell me what I am not doing right lol
-
Hi there,
so all those fonts are 404ing across the site, due to bad URLs.
you may see the font loading on some pages as the font may be cached in your browser or installed on your desktop.Here are the correct URLs for .woff2 files for each of the @font-face rules
https://vccid.org/staging/wp-content/themes/Vccid-Theme/fonts/Vccid-heading-font/vccid-heading-font-webfont.woff2
https://vccid.org/staging/wp-content/themes/Vccid Theme/fonts/Vccid-body-font/kollektif-webfont.woff2
If you have the .woff, .ttf, .svg fonts and want to load them, then its the same URLs with just the file extension change. But for most fonts on modern browsers .woff2 is sufficient.
-
Rachel
Thank you its working now!
-
Glad to hear that
- You must be logged in to reply to this topic.