The TTFTitles WordPress Plugin

This plugin lets you use images to replace the titles of your posts, thus circumventing the problem of guessing what fonts your end-users might have installed.

This is primarily a reworking of the Image Headlines plugin by Brian “ColdForged” Dupuis, so that it would work in WordPress 2.3. Of course, THAT was a reworking of another plugin by Joel Bennett. Anyway, this plugin lets you replace text on your site (titles specifically, but you can actually replace just about anything) with atttractively rendered TrueType Fonts images.

The README file included in the zip archive explains some details of installation, such as permissions for the fonts and cache directories.

If you use this, I’d love to hear about. If you have problems, I’d love to hear those two. Feel free to leave comments here in either case.

Admin Interface

You get a new tab under Presentation called ‘TTF Titles.’ This has three subtabs: ‘Styles,’ ‘Cache,’ and ‘Fonts.’

In the ‘Styles’ tab, you can define different text styles. A style includes the font, size, color, shadow, spacing, etc. The styles you define here will be used in template tags in your theme files.

Screenshot of the Styles Tab

In the ‘Cache’ tab, you can set a few particulars about the image cache, basically where it is and how long images last before they expire.

Screenshot of the Cache Tab

In the ‘Fonts’ tab, you can install fonts, view those already installed, and delete ones you no longer need.

Screenshot of the Fonts Tab

Template Tags

There are two template tags you can use to actually make the text images show up:

<?php the_ttftitle(before, after, display, style, overrides); ?>
<?php the_ttftext(text, style, overrides); ?>

The tag ‘the_ttftitle’ can be used to replace ‘the_title.’ The first three arguments for the_ttftitle are the same as for the_title. The tag ‘the_ttftext’ can be used to turn any chunk of text into an image.

The ’style’ argument should be the name of a style defined in the ‘Styles’ tab. You can use ‘null’ for this argument to use the default style.

The ‘overrides’ argument can be used to override any of the parts of the style. It should look like: name1=val1&name2=val2… The variables you can override are:

Variable Meaning Example
font_name the name of the font Warp 1
font_size the font size to use 24
font_color the color of the text #FF0000
bg_color the background color #FFFFFF
bg_transparent make the background transparent? true
bg_image an image to put in the background null or a filename
indent indent of the first line 5
maxwidth how wide a line can be… 0 for no limit 500
subindent indent for subsequent lines 20
leading space between lines 10
effect_type what kind of shadows? none, hard_shadow, or soft_shadow
soft_shadow_color the color of the soft shadow #000000
soft_shadow_spread how fuzzy the shadow is 5
soft_shadow_x_offset horizontal offset of the shadow 3
soft_shadow_y_offset vertical offset of the shadow 3
hard_shadow_color_1 hard shadow inside color #FFFFFF
hard_shadow_color_2 hard shadow outside color #000000
hard_shadow_offset hard shadow offset 2

Styling the Images

Beyond the ’styles’ used by TTF Titles, you might also want to apply some CSS properties to the resulting images. To make this easier, the images are marked as belonging to the class ‘ttf’. This was added in 0.1.5, when I realized I wanted to style just the text images and couldn’t.

Updates

  • 10/18 – 10:04 – Version 0.1.1 released. Added error suppression for when then font does not contain all the characters you need. Also updated README to be clearer when it comes to permissions.
  • 10/18 – 10:13 – Version 0.1.2 released. Got rid of some pesky control-Ls in the code. My bad.
  • 10/18 – 10:58 – Version 0.1.3 released. Removed call to str_split that was causing problems for some people.
  • 10/18 – 17:20 – Version 0.1.4 released. Minor cosmetic change that should make things clearer when defining a new style.
  • 10/23 – 19:31 – Version 0.1.5 released. Removed the ‘border=0′ from the img tags and added style=”ttf”. Who am I to say they shouldn’t have borders? Also, this makes them easier to style in general.
  • 10/25 – 17:27 – Version 0.1.6 released. Small change to provide compatibility back to WP 1.5.2.
  • 11/13 – 12:01 – Version 0.2 released. Added a ‘Usage’ tab and the letter_case style feature.
  • 11/13 – 07:10 – Version 0.2.1 released. Fixed a really really sloppy bug. My bad!
  • 11/13 – 07:58 – Version 0.2.2 released. Fixed an even dumber bug.
  • 12/10 – 16:35 – Version 0.4.1 released. Should have been 0.4.0, but I messed up with svn check in. Added contextual help. Fixes a few bugs.
  • 12/11 – 07:02 – Version 0.4.2 released. Fixed incompatibility with older PHPs

Related Posts

  • Chapter Quotes for WordPress Posts Revisited
    A few months ago, I wrote a post about adding chapter quotes to your WordPress posts. Here I'll show you another way to add them to posts without them showing up outside of the single-post page, and ...
  • Conditional Shortcodes WordPress Plugin
    BlueHostDreamHostGoDaddyJustHost Conditional Shortcodes is a WordPress plugin that gives the power of conditional tags to the people writing and editing the content. As theme desig...
  • The Custom Rel WordPress Plugin
    BlueHostDreamHostGoDaddyJustHost Starting with version 2.8, WordPress automatically puts relational link tags in the heads of posts. This is not a bad thing at all. Not only are they st...

Leave a Reply

HostMonster for Great Unlimited Web Hosting Hundreds of template and themes from $35