-
AuthorPosts
-
April 9, 2022 at 11:58 am #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 ^^)
April 9, 2022 at 5:16 pm #1347797Hey Ramon,
Thanks for your question, please try this script in your child theme functions.phpfunction 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,
MikeApril 11, 2022 at 7:44 am #1347905hey 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
April 11, 2022 at 2:07 pm #1347956Hi,
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
on the example 1 page you can see that even on reload the script is removing the link:
but layerslider is is adding the link back in after the DOM on reload
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,
MikeApril 11, 2022 at 7:18 pm #1347999hey 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 :-)
April 11, 2022 at 11:22 pm #1348009 -
AuthorPosts
- You must be logged in to reply to this topic.