Community Forums › Forums › Archived Forums › Design Tips and Tricks › Not sure why Google Fonts aren't working
- This topic has 7 replies, 2 voices, and was last updated 9 years ago by Christoph.
-
AuthorPosts
-
April 12, 2015 at 1:08 am #147546PaulGMember
So, I've read the other threads about the Google fonts and the tutorial. I'm stumped as to why they're not displaying on my site. I'm just trying to get one font to work for now. I want to try the Sanchez font for the headers and body.
In the wordpress menu, under: Genesis|Custom Code|Custom Functions - I have added this code:
//* Enqueue Google Fonts
add_action( 'wp_enqueue_scripts', 'genesis_sample_google_fonts' );
function genesis_sample_google_fonts() {
wp_enqueue_style( 'google-fonts', '//fonts.googleapis.com/css?family=Sanchez', array(), CHILD_THEME_VERSION );
}And under: Genesis|Custom Code|Custom CSS - I have added:
//* Use Sanchez font
h1,
h2,
h3,
h4,
h5,
h6 {
font-family: 'Sanchez', serif;
}body {
font-family: 'Sanchez', serif;
}And it doesn't work. I've tried just about every variation of the code I've found on the forums and in tutorials and nothing I've done has worked. What am I doing wrong?
Paul
April 12, 2015 at 8:17 am #147570ChristophMemberHi Paul,
can you post a link to your website?
Next time you paste code, please use the code tags just above the text editor. (It´s the second button from the right.)
Otherwise your code will be formatted.
April 12, 2015 at 2:00 pm #147600PaulGMemberHey Christoph,
Sure. My site is http://www.paulscopy.com
Here's the code again just in case it helps. Here's what I put in Genesis|Custom Code|Custom Functions
//* Enqueue Google Fonts add_action( 'wp_enqueue_scripts', 'genesis_sample_google_fonts' ); function genesis_sample_google_fonts() { wp_enqueue_style( 'google-fonts', '//fonts.googleapis.com/css?family=Sanchez', array(), CHILD_THEME_VERSION ); }
And here's what I put in Genesis|Custom Code|Custom CSS
//* Use Sanchez font h1, h2, h3, h4, h5, h6 { font-family: 'Sanchez', serif; } body { font-family: 'Sanchez', serif; }
Paul
April 12, 2015 at 2:40 pm #147605ChristophMemberHi Paul,
the font is being loaded but the Prose theme has a setting that minifies the css.
When you make changes you have to switch the minification off, save the changes and then you can turn the minification on again. (The checkbox is located somewhere at the bottom of the Prose settings window.)I would try that and if it doesn't work I´ll tell you how to change the css file directly.
April 12, 2015 at 2:49 pm #147607PaulGMemberHey Christoph,
Thanks. I tried that but nothing changed. Minification on and off and I also tried minification off, saved custom css, minfication back on and still nothing changed.
Paul
April 12, 2015 at 3:08 pm #147610ChristophMemberHi Paul,
sorry I overlooked something...
In your code for the css you have to close the comment.
//* Use Sanchez font
leaves the comment open so everything afterwards is not being executed.This is how it should look like
/*Use Sanchez font */
I would also include p as selector with body so it looks like
body, p {
Let me know if that works.
April 12, 2015 at 3:23 pm #147612PaulGMemberHey Christoph,
Yes. It worked perfectly!
It was interesting because before I changed the body text code to
body, p {
only some of the text in the actual body was using the new font.But after the change it all uses the new font. I'm not sure why this is. You can probably tell I'm new at this.
Thank you for your help. This has been bugging me for a couple weeks now! I should have asked sooner.
Paul
April 12, 2015 at 4:30 pm #147650ChristophMemberHi Paul,
you are welcome.
Yes, just write in your questions.
It might take a while for someone to answer it, but chances are you will get an answer.
-
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.