David Braun
David Braun

Reputation: 409

wordpress: load my webfont instead of google-font?

I'm tinkering in my WordPress-Theme, again...

Would it make sense to load and register my own font instead of google's, since I use mine but don't use theirs?

I thought I'd just tweak the theme I run, and replace the

function load_fonts() {
      wp_register_style('myFont', 'url_to_myFont's_CSS_stored_locally');
      wp_enqueue_style( 'myFont');
   }

I am not sure if this could work with the font's styles (light, light-italic etc.)

Thanks for hints and insights! david

Upvotes: 0

Views: 63

Answers (1)

enigma
enigma

Reputation: 3491

Generally themes use Google's font repository to load 'custom' fonts for the theme. You absolutely can replace it with a font of your own choosing - but it probably makes sense to check if it already exists within Google's repo before hard coding your own path. It could potentially speed up loading times if someone has already visited a website that uses said font, although I suppose this is less likely than the popular JS libraries.

If you do provide your own font, make sure you have it under an appropriate license, and are legally allowed to.

Upvotes: 1

Related Questions