Forums

Typeface.js (8 posts)

  1. Shifty88
    Member
    Posted 3 years ago #

    I just began working with WordPress and am still pretty new to all its functions and ways of doing things.

    Right now, I'm battling with a little script called "typeface.js". I have implemented it on my regular website quite easily. All that I need to do is place 2 javascript files in the head of my theme files (BEFORE the stylesheet.css).

    But for whatever reason, it is not reading/finding the javascript files when I place them in the head of hte document.

    Has anyone had any experience with font replacement scripts and wordpress?

    Any help at all would be greatly appreciated.

  2. esmi
    Theme Diva & Forum Moderator
    Posted 3 years ago #

    Are you sure that the call to the scripts is coded correctly within your theme? For example, if you placed the scripts in your theme folder, your header.php file should contain the line:

    <script src="<?php bloginfo('template_directory'); ?>/script_name.js" type="text/javascript"></script>

  3. Shifty88
    Member
    Posted 3 years ago #

    I used an absolute link to the script. I used my domain name...

    I will try it this way too.

    *EDIT: no luck with that method. It's still not finding the scripts...

  4. esmi
    Theme Diva & Forum Moderator
    Posted 3 years ago #

    Are you sure the scripts aren't being found? Or could it be that there's an onload issue? I've come across a situation before (not with WordPress. I hasten to add) where I ended up having to create an onload script to call a number of external js scripts. The memory has just gone awol on me so I can't recall the details now but I do remember that the overall effect, if I called the scripts separately, was that 1 script took precedence and stopped the second from loading at all.

    That's probably not much help but it's all I can think of right now.

  5. Shifty88
    Member
    Posted 3 years ago #

    I can only assume they aren't being found. The same thing happens (the text doesn't render as image) when they aren't found on my plain html page.

    I don't understand what could be interfering with them though. When I place them above the line that calls the overall stylesheet, it renders the type (not without a few other problems though).

    Why would the stylesheet link be causing problems?

  6. Shifty88
    Member
    Posted 3 years ago #

    Well I figured it out.

    Apparently typeface.js doesn't work properly if the theme's style.css is using @import to call more .css files into it.

    I just put all my styles into my main style.css file and it works like a charm!

  7. hahapower
    Member
    Posted 2 years ago #

    hi Shifty88, i have the same problem. can you tell me what you mean by "Apparently typeface.js doesn't work properly if the theme's style.css is using @import to call more .css files into it.?" Thanks!

  8. Kobevl
    Member
    Posted 2 years ago #

    @Shifty88. Please provide more info how you solved the problem. I have just the same problem. If I delete my link to the style.css file, typeface.js work correctly. I don't use @import in that style sheet.

    tx!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags