How to self host fonts and have them show up in all the Full Site Block Editor Typography options, including global styling
How to self host fonts and have them show up in all the Full Site Block Editor Typography options, including global styling
How to self host fonts and have them show up in all the Full Site Block Editor Typography options, including global styling
If you check your source code and look for “fonts.” you will find a line that is calling the stylesheet. This could be “googleapis.com” or “google.com or other URL. Here’s how mine looks (using Astra theme); <link rel=”stylesheet” id=’astra-google-fonts-css’ href=”https://fonts.googleapis.com/css?family=Roboto%3A400%2C&display=fallback&ver=4.0.2″ media=”all” /> Make note of the ID (astra-google-fonts-css) and then add the following to your … Read more
You can try the following steps: Open your WordPress dashboard and go to the Appearance –> Editor page. In the editor, open the style.css file, which is located in the right sidebar under “Stylesheets.” At the top of the style.css file, add a new @font-face rule to define your self-hosted font. The @font-face rule should … Read more
Remove Unwanted Font Files from Loading into WordPress Frontend
How I define max cache time to Google Fonts installed on my site
You may also want to try to deregister the style within your function since it has been register in the parent theme function. Try: function remove_google_fonts_stylesheet() { wp_dequeue_style( ‘pixgraphy_google_fonts’ ); wp_deregister_style(‘pixgraphy_google_fonts’); } add_action( ‘wp_enqueue_scripts’, ‘remove_google_fonts_stylesheet’, 100 );
Should I use wp_register_style(), wp_enqueue_style, or both?
Most of the time when I have an issue with @font-face is because my src path isn’t right. Maybe check the console to see if the call to your fonts files return a 404. If your font-face is being called in the style.css in the root of your theme then your font path is more … Read more
As Buttered_Toast mentioned, I think the hook you want to use is wp_enqueue_scripts rather than after_setup_theme. Changing the priority is also a good idea to make sure your function trigger after the initial call from the parent theme. So your function would be: /** * Remove Accelerate Google fonts */ function remove_accelerate_google_fonts() { wp_dequeue_style( ‘accelerate_googlefonts-css’ … Read more
There are various ways to accomplish this, but I think it’s neatest and “most WordPress” to enqueue the fonts in your functions file, and then you can specifiy that they should load in the footer using the appropriate parameter: function wpb_add_google_fonts() { wp_enqueue_style( ‘wpse-google-fonts’, ‘http://fonts.googleapis.com/css?family=Roboto’, ”, ”, true ); } add_action( ‘wp_enqueue_scripts’, ‘wpse_add_google_fonts’ );