Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #620767

    Hello,

    i want to try a individual font. I know how to use google fonts now (https://kriesi.at/support/topic/google-titillium-webfont-einbinden/) but i find no clue, were to put the code, which myfont gave me:

    <script type="text/javascript">
        (function() {
            var path = '//easy.myfonts.net/v2/js?sid=285408(font-family=Ciutadella+Slab+Medium)&sid=285409(font-family=Ciutadella+Slab+Semi+Bold)&sid=285410(font-family=Ciutadella+Slab+Regular)&sid=285412(font-family=Ciutadella+Slab+Light)&key=7XaQYsXgYw',
                protocol = ('https:' == document.location.protocol ? 'https:' : 'http:'),
                trial = document.createElement('script');
            trial.type = 'text/javascript';
            trial.async = true;
            trial.src = protocol + path;
            var head = document.getElementsByTagName("head")[0];
            head.appendChild(trial);
        })();
    </script>

    Can you help me please.

    Kind regard,
    Daniela

    #620862

    Hi Daniela!

    Please copy and add the below code in functions.php

    function add_custom_code(){
    ?>
    <script type="text/javascript">
        (function() {
            var path = '//easy.myfonts.net/v2/js?sid=285408(font-family=Ciutadella+Slab+Medium)&sid=285409(font-family=Ciutadella+Slab+Semi+Bold)&sid=285410(font-family=Ciutadella+Slab+Regular)&sid=285412(font-family=Ciutadella+Slab+Light)&key=7XaQYsXgYw',
                protocol = ('https:' == document.location.protocol ? 'https:' : 'http:'),
                trial = document.createElement('script');
            trial.type = 'text/javascript';
            trial.async = true;
            trial.src = protocol + path;
            var head = document.getElementsByTagName("head")[0];
            head.appendChild(trial);
        })();
    </script>
    <?php
    }
    add_action('wp_head', 'add_custom_code');

    Cheers!
    Vinay

    #621550

    That works. Thank´s a lot!!!

    Cheers, Daniela

Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘Test individual font: code into head’ is closed to new replies.