Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @tomdhu

    Thank you for your inquiry and I am happy to assist you with this.
    W3 Tache does not block this as you mentioned, and also, W3TC cannot optimize fonts for the time being.
    YOu should address this issue to the support of the plugin used to upload fonts.
    This can be achieved manually also by editing the header.php of the theme and using <link rel="preload">.
    The could should be like this:
    <link rel="preload" href="fonts/some-font.woff2" as="font" type="font/woff2" crossorigin="anonymous">
    WHat this means is explained below:
    rel – tells the browser to preload the font file.
    href – this is the link to the font file. So you need to edit this part and add the link of the file you wish to preload.
    as – “as what?” – the browser asks – as a font file.
    type – this specifies the font file type. You’ll need to change it if you want to preload a different file type.
    crossorigin – add this to avoid browsers ignoreing preloaded fonts without the crossorigin attribute, which will cause the browser to actually fetch the font twice
    So in your case, it should look something like this:

    <link rel="preload" href="/wp-content/themes/Avada/includes/lib/assets/fonts/icomoon/icomoon.woff" as="font" type="font/woff" crossorigin="anonymous">
    I hope this helps!
    Thanks!

    Thread Starter tomdhu

    (@tomdhu)

    Hi Marko,
    Thanks for the fast response. I am most grateful for your support and your patience considering I am a novice when it comes to code.

    I placed your suggestion in <HEAD> PAGE SECTION INJECTION ( for every page) using the “My Custom Functions” but it actually made it slower.

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @tomdhu

    Sorry to hear that.
    You should try editing your header.php template directly. You can find it on your server or via your wp-admin in Appearance>Theme Editor. Select your theme and then header.php.
    Thanks!

    Thread Starter tomdhu

    (@tomdhu)

    Hi,
    Update.
    The Appearance>Theme Editor took me to the Child Theme stylesheet where I pasted ….
    <link rel=&quot;preload&quot; href=&quot;/wp-content/themes/Avada/includes/lib/assets/fonts/icomoon/icomoon.woff&quot; as=&quot;font&quot; type=&quot;font/woff&quot; crossorigin=&quot;anonymous&quot;>

    But nothing changed.
    I then tried pasting it in the parent theme header.php and it complained with “Scrape nonce check failed”.

    Thank you for your patience.

    Thread Starter tomdhu

    (@tomdhu)

    Apologies,

    What I pasted was…
    <link rel=&quot;preload&quot; href=&quot;/wp-content/themes/Avada/includes/lib/assets/fonts/icomoon/icomoon.woff&quot; as=&quot;font&quot; type=&quot;font/woff&quot; crossorigin=&quot;anonymous&quot;>

    Thread Starter tomdhu

    (@tomdhu)

    Hi,

    Together we managed to trace why the preload would not work. It was due to some rich text schema that was in the Head section. This text was checked out as OK by Google’s RT tester. Hee it is.

    <script type="application/ld+json" class="yoast-schema-graph">
    {
    "@context":"https://schema.org",
    "@graph":[{"@type":"WebSite",
    "@id":"https://www.trapbarn.com/#website",
    "url":"https://www.trapbarn.com/",
    "name":"TrapBarn",
    "description":"Buy Fenn Traps and save! Mark4 for rat, squirrel, weasel. Mark6 for mink& rabbit.Free trapping advice",
    "potentialAction":[{"@type":"SearchAction",
    "target":"https://www.trapbarn.com/?s={search_term_string}",
    "query-input":"required name=search_term_string"}],
    "inLanguage":"en-US"},
    {
    "@type":"ImageObject",
    "@id":"https://www.trapbarn.com/#primaryimage",
    "inLanguage":"en-US",
    "url":"https://www.trapbarn.com/wp-content/uploads/2019/09/Hi-res-BT-B-logo-150x70.png","width":150,"height":79,
    "caption":"Trap Barn logo"},
    {
    "@type":"WebPage",
    "@id":"https://www.trapbarn.com/#webpage",
    "url":"https://www.trapbarn.com/",
    "name":"TrapBarn | Home","isPartOf":
    {
    "@id":"https://www.trapbarn.com/#website"},
    "primaryImageOfPage":
    {
    "@id":"https://www.trapbarn.com/#primaryimage"},
    "datePublished":"2012-10-04T10:45:44+00:00",
    "dateModified":"2020-08-03T10:47:21+00:00",
    "description":"Buy Fenn traps direct ex-factory from  Trap Barn- the on-line outlet for Fenn Traps Ltd. Get free trapping advice plus videos on the best way to set and use your traps.","inLanguage":"en-US",
    "potentialAction":[
    {
    "@type":"ReadAction",
    "target":["https://www.trapbarn.com/"
    ]
    }
    ]
    }
    ]
    }

    Could you suggest why this should be?

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @tomdhu

    Thank you for the info.
    Your code is not correct. It should be something like:
    <link rel="preload" href="/wp-content/themes/Avada/includes/lib/assets/fonts/icomoon/icomoon.woff" as="font" type="font/woff" crossorigin="anonymous">
    I would recommend to check with your developer and add the code properly.Chiled theme header.php should work.
    Also please check this link for more details.
    Thanks!

    Thread Starter tomdhu

    (@tomdhu)

    Hi Marko,

    Many thanks for your assistance, it is greatly appreciated.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Preload key requests’ is closed to new replies.