• I chose the font I want (Raleway medium), I downloaded it, then I went to fontsquirrel and through the Font generator I downloaded the kit (which is a folder with all font formats (ttf, eot ect…) referred to, in my case, Raleway, and the stylesheet.css. I uploaded the files to example.com/wp-content/themes/hueman/fonts/raleway. (“raleway” is a sub-folder I created where I put the font formats and the stylesheet.css)

    Then I went to the theme functions.php and I added this code:

    add_action('wp_print_styles', 'add_custom_font');
    
    function add_custom_font() {
        $url = 'https://www.simsworld.it/wp-content/themes/hueman/fonts/raleway/stylesheet.css';
        wp_register_style('ralewaymedium', $url);
        wp_enqueue_style('ralewaymedium');
    }

    Then I tried to use it by creating a new page and adding this:

    <span style=”font-family: ralewaymedium”>Hello</span>

    But it didn’t work, I also tried to add the font via @font-face but when I tried to type this:

    p {
       font-family: ralewaymedium;
    }

    To the WYSIWYG default editor, it seemed wordpress saw that as a simple text and not as css code. (Obviously I used the text mode and not the visual mode)

    Sorry for my bad english but I’m not english. Hope you will understand what I wrote. ^^’

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘I can't add new font’ is closed to new replies.