Custom CSS fonts in child theme - enqueue fonts for Sparkling theme


First of all big thanks for this incredible WP theme and all the support we get here! :slight_smile:

I want to display a text banner on top of the slider images with custom CSS font defined with @font-face, all defined in child theme’s functions.php & style.css. The CSS works fine in clean vanilla HTML/CSS, but does not when called from the sparkling_featured_slider() function in child theme. Is the @font-face overwritten somewhere on the way of cascading styles then?

Any point of direction into theme’s code would be helpful :slight_smile:




Thank you for your positive feedback! I really appreciate it.

@font-face is not the way have you use fonts inside WordPress. Fonts are enqueued using wp_register_style and wp_enqueue_style. For more information you can check WordPress documentation that you can find here.

You can see an example how we have enqueued Google Fonts for Sparkling theme. You can use the same example to enqueue and later use this font.

If you are going to use a local font hosted on your website you can see have we are using FontAwesome icons. See it here.