Load Google Fonts locally - unenquene Google Font

Hi there,
Using Font-Manager and Pro Theme.

I want to disable Google-Font loading globally with functions.php and add custom css for loading the woff fonts.
I tried code within this forum. But it doesn’t stop loading fonts from google.

How can i stop loading google fonts?
I don’t want to add them manually in font-manager, because its easier to add some css-code for it.

Thanks

Didnt work:

function x_remove_google_fonts(){

    wp_dequeue_style( 'x-font-custom' );

    wp_dequeue_style( 'x-font-standard' );

  }

  add_action( 'wp_enqueue_scripts', 'x_remove_google_fonts', 100 );

Hello Kevin,

If you have updated to X version 6.1.x and Cornerstone 3.1, you can fully disable Google Fonts without custom code, you can follow these steps:

  1. Go to Theme Options → Typography

  2. Enable use of the Font Manager

  3. Click the Settings icon in the Bar and navigate to Fonts

  4. Modify each font to reference a system font instead of a Google font

  5. After these changes are saved, no references will be made to Google Fonts on the front end of your site.

  6. Additionally, you can immediately force Google Fonts to not load by adding this code to functions.php of a child theme:

    add_filter( 'cs_load_google_fonts', '__return_false' );

Hope this helps.

2 Likes

Thank you. This helped!

Solution:
I added the filter to functions.php and then loading locally font
by adding custom css:

/* open-sans-regular - latin */

@font-face {
    font-family: 'Open Sans';
    font-style: normal;
    font-weight: 400;
    src: local('Open Sans Regular'), local('OpenSans-Regular'), url('/wp-content/themes/pro-child/fonts/open-sans-v17-latin-regular.woff2') format('woff2'), /* Super Modern Browsers */
    url('/wp-content/themes/pro-child/fonts/open-sans-v17-latin-regular.woff') format('woff'); /* Modern Browsers */
}

/* open-sans-700 - latin */

@font-face {
    font-family: 'Open Sans';
    font-style: normal;
    font-weight: 700;
    src: local('Open Sans Bold'), local('OpenSans-Bold'), url('/wp-content/themes/pro-child/fonts/open-sans-v17-latin-700.woff2') format('woff2'), /* Super Modern Browsers */
    url('/wp-content/themes/pro-child/fonts/open-sans-v17-latin-700.woff') format('woff'); /* Modern Browsers */
}

/* lora-regular - latin */

@font-face {
    font-family: 'Lora';
    font-style: normal;
    font-weight: 400;
    src: local('Lora Regular'), local('Lora-Regular'), url('/wp-content/themes/pro-child/fonts/lora-v14-latin-regular.woff2') format('woff2'), /* Super Modern Browsers */
    url('/wp-content/themes/pro-child/fonts/lora-v14-latin-regular.woff') format('woff'); /* Modern Browsers */
}

/* lora-700 - latin */

@font-face {
    font-family: 'Lora';
    font-style: normal;
    font-weight: 700;
    src: local('Lora Bold'), local('Lora-Bold'), url('/wp-content/themes/pro-child/fonts/lora-v14-latin-700.woff2') format('woff2'), /* Super Modern Browsers */
    url('/wp-content/themes/pro-child/fonts/lora-v14-latin-700.woff') format('woff'); /* Modern Browsers */
}

You’re most welcome, Kevin and thanks for sharing.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.