Load local fonts
-
Hi, due to the European GDPR Regulation I need to stop my theme loading fonts from Google and instead load them locally. I’ve downloaded all Fonts and placed the files in a fonts Directory. I added a @fontface rule in my CSS. (Please take a look below):
@font-face { font-family: 'Roboto'; font-style: normal; font-weight: 100; font-display: swap; src: url('../fonts/roboto-v30-latin-100.eot'); /* IE9 Compat Modes */ src: local('Roboto'), url('../fonts/roboto-v30-latin-100.eot?#iefix') format('embedded-opentype'), /* IE6-IE8 */ url('../fonts/roboto-v30-latin-100.woff2') format('woff2'), /* Super Modern Browsers */ url('../fonts/roboto-v30-latin-100.woff') format('woff'), /* Modern Browsers */ url('../fonts/roboto-v30-latin-100.ttf') format('truetype'), /* Safari, Android, iOS */ url('../fonts/roboto-v30-latin-100.svg#Roboto') format('svg'); /* Legacy iOS */ }
(I repeated this with all font-sizes)
Problem: The local fonts are not loaded. Is it because messed sth. up in the functions.php? I commented out certain parts in the functino.php. Please see below. Do I have to modify this in a certain way?
// 25.10.22 // if(!isset($site_font['url'])){ // wp_enqueue_style("sth_GoogleFont","https://fonts.googleapis.com/css?family=Roboto+Condensed:400,100,200,300,500,600,700,800,900" , false, "1.0"); // } // else{ // $site_font_url = preg_replace("/^http:/i", "https:",$site_font['url']); // wp_enqueue_style("sth_GoogleFont",$site_font_url , false, "1.0"); // }
Thank you very much,
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Load local fonts’ is closed to new replies.