I am attempting to enqueue web fonts that I am loading in via the WebINK font library. (This service is similar to Typekit). This service works by generating a unique CSS link for each unique site. I have successfully enqueued Google WebFonts before, but am struggling with enqueueing WebINK's CSS. I'm thinking the problem has to do with the url. When I try and enqueue my function in my functions.php file, my entire theme breaks. Does anyone notice a weird rogue character that might cause this? Here's my code:

<?php function load_fonts() {
    $url = 'http://fnt.webink.com/wfs/webink.css/?project=F2330038D0-5466-4169-867D-EA751332DE4B&fonts=A65E74B3-95D4-8C3A-5583-87B47A9527A2:f=FaktPro-Thin,343BD4E1-D395-6C6D-B14B-41223AE23241:f=MyriadPro-SemiCnIt,E46BFE22-44C1-99D7-2C08-D8826DA7A208:f=FaktPro-BoldItalic,050FBD0F-5D55-410F-DC57-586D49D23CB:f=MyriadPro-Semibold,14B608E7-5D2C-4B50-D4D1-A22D8DDD15C6:f=DecaSerif-BoldItalic,0B53932F-D113-4C4B-B456-D77C9990FD8C:f=MyriadPro-BlackIt,3C16CF08-2801-1E29-3FE1-49842D2DBCB4:f=MyriadPro-BlackSemiExtIt,4450DACC-A2BA-8272-5A58-A6BEE972148B:f=FaktPro-NormalItalic,64E76F68-92AA-FB9F-C7C0-E5EA6D18052A:f=MyriadPro-SemiCn,B404E18C-7A35-1F7C-A1BC-CA3E46910C47:f=FaktPro-ThinItalic,5BD20078-1B4C-4661-F184-D61DFFE3C81A:f=DecaSerif-Bold,39FEB533-C926-4578-87C0-2D25696AA0F9:f=MyriadPro-Cond,8C0A5296-5130-F7B2-72D2-2BF48B1A22CC:f=MyriadPro-LightSemiExt,0797E150-9402-2B85-B059-6803DEAB9AE6:f=MyriadPro-LightCondIt,DBDBD77A-5EE5-6C3D-0419-9F4D382A64D6:f=FaktPro-Black,230870A2-309B-B58A-6167-BE6832E4B9DF:f=MyriadPro-LightSemiExtIt,8C5B073A-F3EB-BF79-99E3-C3C42439FD61:f=MyriadPro-BoldCond,14271B4B-F5A8-EDF2-9A5A-ADBD6595E88F:f=FaktPro-BlackItalic,9128D502-D19E-B9A8-A946-E9923AB2F1D3:f=FaktPro-BlondItalic,32E29AA5-52D1-469A-C546-476768AD2051:f=MyriadPro-BlackCond';
    wp_register_style( 'fonts', $url, false, '1.0', 'all' );
    wp_enqueue_style( 'fonts' );
add_action( 'wp_enqueue_scripts', 'load_fonts' ); ?>

* Slight note...if you try and access the following url, you will get an error. I have changed the project number so that people are unable to use my account. The overall format of the link is the same though.

** The link is a CSS file. @font-face declarations are defined in the CSS file like you would in a normal CSS file.

Any thoughts?

  • My theme doesn't break when I enqueue that, though of course it doesn't work (as you explained). Does this break for you when you enqueue a bad URL like that above or only when you enqueue a working one? If the latter, the problem would seem to be on webink's end. – s_ha_dum Feb 4 '13 at 1:19
  • @s_ha_dum Weird...I also tried encoding the bad URL above and it breaks my theme. So, I'm not sure what's going on here. Maybe something's wrong with my functions.php file? – kaffolder Feb 5 '13 at 4:27
  • @s_ha_dum Think I may have found the culprit...always seems to be the simple things. :) Scanned through my functions.php file and realized that I have already enqueued a similar function in which I had pulled in Google Webfonts. Commented out that function which is the same exact name load_fonts(); as the WebINK function I was trying to use. Thanks for the input @s_ha_dum. Should be on the right track now. – kaffolder Feb 5 '13 at 4:29
  • Well there you go. You can post your own answer and accept it. And that keeps the site neat. – s_ha_dum Feb 5 '13 at 5:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.