0

I am trying to add google fonts to a custom WordPress theme. Therefore I tried to enqueue selected three font faces at once to make it fast loading. So, I use the below codes to register and enqueue the same.

wp_register_style('googlFonts', '//fonts.googleapis.com/css2?family=DM+Sans:ital,wght@0,400;0,500;0,700;1,400;1,500;1,700&family=DM+Serif+Display&family=La+Belle+Aurore&display=swap');
wp_enqueue_style('googlFonts');

When I search via source code I can only see the last font. Other fonts are not loading. Even I can't see the same complete URL in the source code. Below is what I saw from the source code. enter image description here

Can anybody help me with this?

Thanks in advance

3

1 Answer 1

0

Just remove version parameter.

wp_register_style('googlFonts', '//fonts.googleapis.com/css2?family=DM+Sans:ital,wght@0,400;0,500;0,700;1,400;1,500;1,700&family=DM+Serif+Display&family=La+Belle+Aurore&display=swap', array(), null);
wp_enqueue_style('googlFonts');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.