1. N6REJ
  2. Free Templates / Extensions
  3. Saturday, 20 August 2022
  4.  Subscribe via email
I'd like to make a recommendation on how to adjust the template so that custom fonts can be done without things being broken on template update.
In the admin under typography add a 3 state switch.
GoogleAPI/Coollabs api/ custom
Then in "templates/j51_xxx/inc/fonts.php." pull the state of that switch into a var.
use google api url for google, coollabs api for GPDR and if custom use

$app->getDocument()->addStyleSheet('/templates/j51_xxx/css/local-fonts.css');


so, it would look something like this...

$fontsource = "fonts.googleapis.com"
if $fontsource !== 'local'{
foreach ($googlefonts as $v) { // loop
$app->getDocument()->addStyleSheet('//' . $fontsource . '/css?family=' . $v . ':' . $font_weights . '&&subset=' . $font_subset . '&display=swap');
}
} else {
$app->getDocument()->addStyleSheet('/templates/j51_xxx/css/local-fonts.css');
}

Accepted Answer Pending Moderation
0
Votes
Undo
Hello

One current option that is available is to add your font-face CSS to a custom.css. Assuming you have only web safe fonts selected, the $googlefonts array will be empty.

Ciaran
  1. more than a month ago
  2. Free Templates / Extensions
  3. # 1
  • Page :
  • 1


There are no replies made for this post yet.
Be one of the first to reply to this post!