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

    Dear Support Team,

    I want to install a Typekit font on my website. There are a Typekit plugin for WordPress. Here I can not embed the extended code unfortunately. but I need the extended code, otherwise FOUT effect happens.

    I have read on the website of Adobe Typekit that the expanded code to insert at the top of the <head> tag. Here I do not know further. Can you tell me where I need to add in the extended code? Or which way should I go?

    This is the code:

    <script>
      (function(d) {
        var config = {
          kitId: 'XXXXX',
          scriptTimeout: 3000,
          async: true
        },
        h=d.documentElement,t=setTimeout(function(){h.className=h.className.replace(/\bwf-loading\b/g,"")+" wf-inactive";},config.scriptTimeout),tk=d.createElement("script"),f=false,s=d.getElementsByTagName("script")[0],a;h.className+=" wf-loading";tk.src='https://use.typekit.net/'+config.kitId+'.js';tk.async=true;tk.onload=tk.onreadystatechange=function(){a=this.readyState;if(f||a&&a!="complete"&&a!="loaded")return;f=true;clearTimeout(t);try{Typekit.load(config)}catch(e){}};s.parentNode.insertBefore(tk,s)
      })(document);
    </script>

    Many thanks!
    Katrin

    • This topic was modified 8 years, 3 months ago by LorbeerDesign.
    #669823

    Hey LorbeerDesign!

    Please try adding following code to Functions.php file in Appearance > Editor

    function typekit_header_code(){
    ?>
    <script>
      (function(d) {
        var config = {
          kitId: 'XXXXX',
          scriptTimeout: 3000,
          async: true
        },
        h=d.documentElement,t=setTimeout(function(){h.className=h.className.replace(/\bwf-loading\b/g,"")+" wf-inactive";},config.scriptTimeout),tk=d.createElement("script"),f=false,s=d.getElementsByTagName("script")[0],a;h.className+=" wf-loading";tk.src='https://use.typekit.net/'+config.kitId+'.js';tk.async=true;tk.onload=tk.onreadystatechange=function(){a=this.readyState;if(f||a&&a!="complete"&&a!="loaded")return;f=true;clearTimeout(t);try{Typekit.load(config)}catch(e){}};s.parentNode.insertBefore(tk,s)
      })(document);
    </script>
    <?php
    }
    add_action('wp_head', 'typekit_header_code');

    Regards,
    Yigit

    #671340

    Hi Yigit,

    many thanks for your response. I trust not to edit the functions.php. Can you briefly to see screenshot, whether it is right? I do not think so.
    Where the code must be accurately placed for?

    Screenshot functions.php

    best regards :-)

    #671356

    Hey!

    Please place the code to the very bottom of the file instead :)

    Regards,
    Yigit

    #679289

    Hi Yigit,

    Sorry for the late answer. I have the code embedded below.
    Unfortunately, it does not affect my work. This does not appear.

    What am I doing wrong?

    Thanks for your help Yigit!
    best regards

    Screenshot

    #679303

    Hi Yigit,

    I did it. This site is the description:

    I have added the following CSS.

    .wf-loading body {
    font-family: "ff-meta-web-pro",sans-serif;
    visibility: hidden;
    }
    
    .wf-active body {
    font-family: "ff-meta-web-pro",sans-serif !important;
    
    visibility: visible;
    }

    Now I see no FOUT-effect more.

    Thank you nevertheless for your help!
    best regards

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Typekit font FOUT-effect’ is closed to new replies.