I like Cufón. As long as the page loads and the JavaScript executes quickly, it's a really slick solution to using any font you want (and have a license for) on your website. I haven't really used it for body text, but I used it on the Brandwatch site for headers, and I'm currently using it for another site (to be added to the portfolio soon).

Both times I've used it, I've initially relied on plugins: WP-Cufon and All-In-One Cufon, as they've seemed the only viable options. However, I've never been able to make All-In-One Cufon work, and WP-Cufon seems really unreliable. Often it would detect my font in the /fonts/ folder, but would not then add the font as a JavaScript call to the DOM. Obviously, without that, the Cufon didn't work.

I'm still using Thematic/child themes for most of my WordPress development and I realised by looking at what the plugins did to the DOM that it wouldn't be hard to do manually. So, in the end I decided just to use my child theme's functions.php file to add the necessary JavaScript. Turns out it's not that hard. Here it is:

Remember that any hover statements need to come FIRST, as described here.

Just copy and paste all that into your child theme's functions.php, then add the JS files to the right folder in your child theme.This worked straight away for me and seems simple and lightweight. No reliance on plugins that'll need to be updated (even when you can get them to work)!

If this helps, leave me a comment. It'll encourage me to post more juicy Thematic functions...

This entry was posted on 11/06/2010 (Friday) at 7:01 am and is filed under web. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

I couldn't get WP-Cufon to work either. Your code did the trick. Thanks.

I looked over your site, and it seems you use Thematic a lot. I'm just learning to make WP templates. Is Thematic the way to go, or should I try to build them from scratch? I like the fact it's free--unlike J. Tadlock's Hybrid, which charges for documentation--and the fact it's by Automattic, which seems to be the corporation behind WP. I come from Joomla, and know plenty of PHP/MySQL/JS, it's CSS?HTML I'm not that confident with.

I do <3 Thematic. It's a great template upon which to build child themes - if you're not familiar with child theming, I highly recommend that route as the way to go - it lets you achieve thorough themes by applying 'differences' to existing themes, rather than coding everything from scratch. Thematic introduces some great hooks, filters and especially dynamic body and post classes that I find a real boon for agile development.

To really get the most from WordPress theming/child theming, you'll need to invest in some CSS learning - most of what I do is CSS with a few PHP functions and a little jQuery thrown in (and the XHTML is important I guess too). Use Firebug and Web Developer and you'll soon get your head round it

Anyway, hope that's helpful, feel free to shout if you need any pointers

thanks for a prompt reply. I like the dynamic classes too. Since you offfered, I have a couple of questions.

By default, the layout is 960px width. Can this be safely changed, especially increased? Also, while playing with it, I needed line-height set to 1.5, and there are many places where by default it's 100%, so I wound up with

body {line-height:1.5 !important;}

Is that a reasonable exception to the rule to use !important sparingly?

Width can be very happily changed - no probs at all. Nearly all the sites at http://www.divydovy.com/category/portfolio are Thematic child themes - you'll see there's a real mix and that almost anything is possible.

With the CSS - you shouldn't need to use !important. If you are child-theming, you just need to include the same declarations you want to overwrite in your own style.css file (child theme styles overwrite template theme styles, as long as they are as specific). My advice is to check out thematic/library/styles/typography.css - search that for line-height and copy those specific declarations into your own stylesheet. In fact, at the bottom of that stylesheet, Ian shows you exactly how to overwrite his defaults.