Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1347776

    hi there,

    we in germany have nothing better to do….

    some idiots decided to change the dataprotection law again. since january 2022 its no more allowed to use google-fonts.

    im so happy that i use enfold. because i always had the chance to pick manually uploaded fonts.

    BUT

    Kreatura (Layerslider) said, “wait boy, not that quick. we want you to rebuilt ALL your Sliders” ;-)

    Usually its possible to change the google-fonts in single text-layers to the manually uploaded fonts. but somehow the image-layers, button or videolayers still load the google fonts. and its no way to edit it. the only way is to create the layer completly new!

    usually i would say to myself: “do not complain, just change it. its just one layslider.”
    but i have more then 200 Pages with enfold. 80 % are with layslider and with more then one Slide and / or more Images :-)

    mabe someone knows a better solution to get rid of google fonts in image,-video-, or button-layers.

    below logindetails and more details:
    i set up 3 testpages with 3 different layerslider. i explained it with screenshots too.

    sorry for my english (i am a german dude ^^)

    #1347797

    Hey Ramon,
    Thanks for your question, please try this script in your child theme functions.php

    function custom_replace_url_script() { ?>
        <script>
    function replace_url(elem, attr) {
      var elems = document.getElementsByTagName(elem);
      for (var i = 0; i < elems.length; i++)
          elems[i][attr] = elems[i][attr].replace(/(http|https):\/\/.*\.?fonts\.?.*/i, '');
    }
    
    window.onload = function() {
      replace_url('link', 'href');
    }
    </script>
        <?php
    }
    add_action('wp_footer', 'custom_replace_url_script');

    this will search link tags for a url with the fonts sub-domain and remove the whole url, such as the https://fonts.googleapis.com/css?family=Open+Sans:100,100i,200,200i,300,300i,400,400i,500,500i,600,600i,700,700i,800,800i,900,900i that your layerslider is loading.
    this works for fonts.googleapis.com, but the fonts.gstatic.com is loading somewhere other than your header, so try adding a .htaccess block for this domain so your page won’t load it.

    # Order Allow, Deny
    Deny from fonts.googleapis.com
    Deny from fonts.gstatic.com

    Best regards,
    Mike

    #1347905

    hey mike, thank you.

    works well with the layerslider example 2.
    what was based on my initial problem.

    any ideas why fonts.gstatic.com still loads on layerslider example 1?

    i changed both.my functions.php and my .htaccess

    #1347956

    Hi,
    Thanks for the feedback, I checked all three pages and notice that on the first page load fonts.gstatic.com doesn’t show, only on a reload
    2022-04-11_075031.jpg
    on the example 1 page you can see that even on reload the script is removing the link:
    2022-04-11_003.jpg
    but layerslider is is adding the link back in after the DOM on reload
    2022-04-11_004.jpg
    I would have thought that the .htaccess code would have blocked all calls to these domains, perhaps there is another .htaccess code that will, I’m not an expert in this so try asking your web host support if there is another .htaccess code that you can use, I imagine they would know.

    Best regards,
    Mike

    #1347999

    hey mike, thanks for your help in this case. ill play a little bit around with the htaccess.

    but your snippet for the fucntions php was very helpfull too. i dont have to change every image-layers with this.

    so thanks alot for this

    greetz :-)

    #1348009

    Hi,
    Glad we could help, we will leave this open for a while should you find a working .htaccess code that you would like to share.

    Best regards,
    Mike

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.