Tagged: google fonts
-
AuthorPosts
-
June 7, 2018 at 5:31 pm #969705
Enfold version 4.4.1
I’ve been trying for two days to get a custom CSS class selector to work with the included Exo Google Fonts, but the theme’s Heading Font choice for font family in the “theme options > general styling > fonts” section keeps overriding my custom CSS font family choice.
In my child theme style.css file I have the following CSS (see pastebin link):
https://pastebin.com/4VxF9JzK
FYI, the font-size and letter-spacing properties do work, just not the font-family property.In the text block on the homepage, I have the following HTML (see pastebin link):
https://pastebin.com/nTT20SpZThe only way I can get the Exo font to apply to the heading font is by selecting it in the “theme options > general styling > fonts” section. But I don’t want the Exo font to be used for site-wide heading titles, only for the special “main-products-heading-title” CSS class I created and added to my child theme style.css file.
On my homepage, just below the full width slider, look for the PRODUCT NAME® heading text to see what I’m referring to. I only want the Exo font family applied to the “main-products-heading-title” CSS class I created for and applied to this heading text.
June 9, 2018 at 3:42 pm #970430Any help on this would be much appreciated.
June 9, 2018 at 6:53 pm #970493Hi killyman,
Do you have the font added to the css? Can you give us temporary admin access to your website in the private content box below, so that we can have a closer look?
Best regards,
VictoriaJune 10, 2018 at 5:37 am #970601The only way I can get the Exo font to apply to the heading font is by selecting it in the “theme options > general styling > fonts” section. But I don’t want the Exo font to be used for site-wide heading titles, only for the special “main-products-heading-title” CSS class I created and added to my child theme style.css file.
I’ve set up a temp admin user account for you to access. See private content section.
June 11, 2018 at 7:40 am #970950Could the issue have to do with the avia-dynamic-css Style Sheet overriding my child theme Style Sheet settings?
June 12, 2018 at 5:10 am #971512Hi,
Thank you for the update.
You have to load the font first before you can use it. The font won’t load when it’s not selected in theme options so you have to load it manually.
// http://www.wpbeginner.com/wp-themes/how-add-google-web-fonts-wordpress-themes/
Example:
function wpb_add_google_fonts() { wp_enqueue_style( 'wpb-google-fonts', 'http://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,700italic,400,700,300', false ); } add_action( 'wp_enqueue_scripts', 'wpb_add_google_fonts' );
That code loads the Open Sans font manually. Replace it with the “Exo” font url.
Best regards,
IsmaelJune 12, 2018 at 6:28 am #971539That worked finally. Thank you so much!
How would I add multiple Google Font families? Do I just repeat the wpb_add_google_fonts code block in the functions.php file as outlined below?
function wpb_add_google_fonts() { wp_enqueue_style( 'wpb-google-fonts', 'http://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,700italic,400,700,300', false ); } add_action( 'wp_enqueue_scripts', 'wpb_add_google_fonts' ); function wpb_add_google_fonts() { wp_enqueue_style( 'wpb-google-fonts', 'https://fonts.googleapis.com/css?family=Exo+2:400,400i,700,700i,800,800i', false ); } add_action( 'wp_enqueue_scripts', 'wpb_add_google_fonts' );
June 13, 2018 at 10:15 pm #972512Hi,
You can just add extra lines of the enqueue and it will make it work out for you.
Best regards,
Basilis -
AuthorPosts
- You must be logged in to reply to this topic.