• Resolved hellu24

    (@hellu24)


    Hi!

    My site ist loading google fonts locally (css) and it was possible for me to stop loading google fonts for SiteOrigin Page Builder Plugin by using this snippet:

    function siteorigin_settings_remove_google() {
    wp_dequeue_style( ‘siteorigin-google-web-fonts’ );
    }
    add_action( ‘wp_enqueue_scripts’, ‘siteorigin_settings_remove_google’, 20 );

    Bit I cannot find a solution to tell also SiteOrigin Widgets Bundle to stop loading form googleapis.
    I have this line at the bottom of the code of my website:

    <link rel=’stylesheet’ id=’sow-google-font-open sans-css’ href=’https://fonts.googleapis.com/css?family=Open+Sans%3A600&display=swap&ver=5.7.2&#8242; media=’all’ />

    Can you help me?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor alexgso

    (@alexgso)

    Hi,

    You can prevent the import of Google Fonts by Widgets Bundle by adding some custom PHP to your website. If you don’t have a method of adding PHP to your website, please install the Code Snippets plugin. Once installed, navigate to Snippets > Add New and add the following PHP:

    function so_dont_import_google_fonts() {
    	if ( ! is_admin() ) {
    		add_filter( 'siteorigin_widgets_google_webfonts', '__return_false' );
    		add_filter( 'siteorigin_widget_get_custom_font_family', function ( $font ) {
    			if ( strpos( $font['family'], ':') ) {
    				$font['family'] = explode( ':', $font['family'] )[0];
    			}
    
    			return $font;
    		} );
    	}
    }
    add_action( 'init', 'so_dont_import_google_fonts' );

    Click Save Changes & Activate.

    If you do have a method of adding PHP to your website, please add the above PHP using that method.

    Kind regards,
    Alex

    Thread Starter hellu24

    (@hellu24)

    Hi Alex,

    so cool!
    That works great. Many Thanks!

    Paul

    Plugin Contributor alexgso

    (@alexgso)

    Hi Paul,

    Great to hear that helped! ??
    Please feel free to post another thread if anything else comes up and we’ll lend a hand.
    Have a good one mate.

    Kind regards,
    Alex

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Tell SiteOrigin Widgets Bundle to stop loading google fonts.’ is closed to new replies.