Minimum & Google Fonts

Community Forums Forums General Discussion Minimum & Google Fonts

This topic is: not resolved

This topic contains 3 replies, has 2 voices, and was last updated by  Bill Murray 1 year, 7 months ago.

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

    mrwilljackson
    Participant
    Post count: 2

    Hi All,

    I’m having problems with google fonts in Minimum Theme, I’d like to use Open Sans and Lobster (only for the site title and description). Currently on OS X in Safari the correct fonts display only when I’m logged into WordPress – on other browsers its defaulting to a cursive font. On PC its even worse comic sans appears (Arrggh!) in Chrome, Firefox and IE 9 does something all of its own…

    The site is here: http://www.timhandyman.co.uk/55M6X7LouM347yp/

    I’m using the minimum functions.php having amended as shown:

    /** Load Google fonts */
    add_action( 'wp_enqueue_scripts', 'minimum_load_google_fonts' );
    function minimum_load_google_fonts() {
    wp_enqueue_style(
    'google-fonts',
    'http://fonts.googleapis.com/css?family=Open+Sans|Lobster',
    array(),
    PARENT_THEME_VERSION
    );
    }

    Css is as follows:


    #title {
    font-family: 'Lobster', cursive;
    font-size: 50px;
    line-height: 1;
    margin: 15px 0 0px;
    }
    #description { font-family: 'Lobster', cursive;
    font-size: 28px;
    color: white;
    }

    This all seems really weird, I think I have a real ‘head slapper’ but i just can’t spot it!

    #18777

    Bill Murray
    Participant
    Post count: 575

    Did you ever get this sorted out?

    The problem you are having is because your call to Google is returning a 404. It has nothing to do with CSS or in all likelihood with browsers (although Google Chrome has issues with Google webfonts). On a quick look, there’s nothing obviously wrong with your change to functions.php. That in turn leads to the next debugging suggestion: try deactivating all of your plugins, and see if you get different results. It seems as if the parameters (everything following css in your call to Google) is getting stripped.

    Btw, you don’t need to enclose Lobster in quotes in your CSS. See this.


    Web: https://wpperform.com or Twitter: @wpperform

    We do managed WordPress hosting.

    #18898

    mrwilljackson
    Participant
    Post count: 2

    Thanks Bill,
    I found that another plugin ‘better WP security’ seemed to be preventing the wp_enque_script forming the following:
    'http://fonts.googleapis.com/css?family=Open+Sans|Lobster'
    So in my source everything after the ? was missing, hence google returns the 404 and the font is broken.

    I’m going to keep using Better WP Security so instead I’ve added the the fonts in the css using @import, which appears to work.

    I wouldn’t have noticed the problem without your ‘heads up’ – cheers!

    - Will

    #18922

    Bill Murray
    Participant
    Post count: 575

    @import will work fine. Since you tracked it down to a specific plugin, it would be great if you report that to the plugin author.

    On Better WP Security, the only setting that I see that could affect this is blocking URL’s longer than 255 characters. Generally speaking, that’s a bad idea and something you should not do. While many long URL’s are security issues, there are a lot of good WP URL’s that are part of normal operations. Blocking them will eventually cause another issue to crop up. In a better world, security plugins would provide a log of long URLs for you to examine and decide which ones to manually block.


    Web: https://wpperform.com or Twitter: @wpperform

    We do managed WordPress hosting.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.