Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #1158787

    Hello,

    I try tu use the webfont service from http://www.fonts.com for a project with enfold child theme.

    The instruction on fonts.com says:
    Copy the code below and paste it into your website’s HTML between the <head> and </head> tags.

    So I looked up this area in the header.php and pasted it in between <head> and </head> but it doesn’t work. Do you know where the code below should go?

    I also copied the header.php from the enfold directory and pasted it into the enfold-child … but it doesn’t do the trick.

    Any ideas how this could work out?

    Cheers!

    #1159070

    Hey nini_bacher,

    Instead of adding it to header.php file, it’s better to use a hook instead: https://kriesi.at/documentation/enfold/add-custom-js-or-php-script/#add-a-script-to-head-section
    In your child theme’s functions.php add this code:

    function add_custom_script(){
    ?>
    <script type="text/javascript" src="//fast.fonts.net/jsapi/00bb5123-8d46-4c97-92b6-a2ab2217d646.js"></script>
    <?php
    }
    add_action('wp_head', 'add_custom_script');

    Hope it helps.

    Best regards,
    Nikko

    #1159154

    Thank you Nikko,

    I put the Code above in its place (and added a ?> in the end), but it still dosen’t work.

    Any further recommendations?
    Below in the private content you can see the complete content of my child themes functions.php

    Cheers!

    #1159731

    Hi,
    Sorry for the late reply, I took a look at your page source code and found your font script in your header, so it seems that the code is working, but you are getting this error from the font:
    Failed to load resource: the server responded with a status of 403 ()
    403 is the “Forbidden Error” so it would seem that your font request is blocked by fonts.com
    please check that the code is correct, or if there is some setting in your fonts.com account to register your site with them.
    I don’t have experience with them, but that would make sense as otherwise anyone could copy your code and use it.

    Best regards,
    Mike

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