wp-Typography FAQs

Things Are Broken

This plu­gin breaks post title links. What gives?

More likely than not, your Word­Press theme is using an improper func­tion to set the title attribute of your heading’s link. It is prob­a­bly using the the_title() func­tion, which deliv­ers the post title after fil­ter­ing. It should be using the_title_attribute() which deliv­ers the post title before fil­ter­ing. Change out this func­tion through­out your theme when it is used inside of an HTML tag, and the prob­lem should go away.

Here are some spe­cific instruc­tions for fix­ing your theme. Please note that every theme is dif­fer­ent, so mileage may vary.

To edit the theme, log in as an admin­is­tra­tor and go to: Appear­ance > Edi­tor. You will typ­i­cally want to edit the fol­low­ing files (if they exist):

  • archive.php
  • index.php
  • page.php
  • search.php
  • single.php

In each file, search for the code that looks some­thing like this:

<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?></a></h2>

Your theme may con­tain some vari­a­tions. For instance, the h2 tags may be h1 or h3… We are look­ing specif­i­cally for the part that says title=" … <?php the_title(); ?> … ". It should be changed to:

<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>

Save the files, and you should be good to go.

If you are uncom­fort­able edit­ing your theme’s code, you may alter­na­tively go to the wp-​​Typography set­tings page in your admin panel and add h1 and h2 to the “Do not process the con­tent of these HTML ele­ments:” field. This will dis­able typo­graphic pro­cess­ing within improp­erly designed page title links and page titles.

There is an error in the core of Word­Press (con­firmed in ver­sion 2.8.2) that uses the wrong func­tion to pro­vide post titles for sec­ondary RSS feeds (like RSS feeds for sin­gle page com­ments or cat­e­gories. This error will return any HTML tags used for CSS Hooks or char­ac­ter styling, and the tags will be vis­i­ble when some­one clicks on the RSS icon in the address bar of their browser. If this both­ers you, your only option (until Word­Press cor­rects this error) is to dis­able all typo­graphic pro­cess­ing in your page titles as described in the para­graph above. Updates on this Word­Press bug may be fol­lowed here.

Why does fil­ter­ing by HTML ele­ment, class or id not pre­vent processing?
wp-​​Typography does not have access to HTML stored in your theme files. It only has access to the con­tent passed to it (i.e. post Title and Con­tent); it is unable to deter­mine the greater con­tex­tual aware­ness. If you try to fil­ter pro­cess­ing based on a class of the body ele­ment – as an exam­ple – noth­ing will hap­pen. wp-​​Typography does not see the body ele­ment. wp-​​Typography does fil­ter by HTML ele­ment, class or id for any markup present within the parsed con­tent. So if you do not want class noTypo processed, fil­ter­ing will only occur within the title or con­tent of your post or page.
Is this plu­gin infected with a virus?
Avira’s free anti-​​virus pro­gram “AntiVir” incor­rectly asserted early ver­sions of this plu­gin as con­tained the “HTML/ADODB.Exploit.Gen” exploit in sev­eral of the lan­guage hyphen­ation pat­tern files. The prob­lem was reported to Avira, but they pro­vided no feed­back for nearly a month. After some exper­i­men­ta­tion, we were able to refor­mat the affected files to avoid the false pos­i­tive. As of ver­sion 1.7 of the plu­gin, this prob­lem is no longer present.
Why is copy-​​and-​​paste not work­ing prop­erly on my site?

This is a known com­pro­mise that comes with hyphen­ation. The hyphen­ation fea­ture works by insert­ing soft-​​hyphen char­ac­ters at every pos­si­ble hyphen­ation point. They are typ­i­cally invis­i­ble, and should only show up at the end of a line if the word wraps.

Unfor­tu­nately, not every edi­tor is smart enough to prop­erly han­dle soft hyphens. Text copied from your web page will include soft hyphen char­ac­ters. Some pro­grams will dis­play a space instead of a soft hyphen. Some may dis­play actual hyphens. And it may break spell check even if the char­ac­ters are dis­played cor­rectly. If you want hyphen­ation on the web, you must use soft hyphens. If you use soft hyphens, other pro­grams may not like copied text.

Why are open­ing quotes not being styled?

This plu­gin offers an option to wrap ini­tial quotes in a span of class quo or dquo. You can then style these classes in your CSS Stylesheet. This is use­ful if you want to – for exam­ple – neg­a­tively indent quotes so the quote hangs in the left mar­gin and the text is aligned with the text below.

Please note, this applies only to ini­tial quotes – quotemarks that appear as the first char­ac­ter of a block of text (like a para­graph or block­quote). This does not apply to all open­ing quotes.

Hyphen­ation Generally

Why are words hyphen­ated incor­rectly or not at all?

This plu­gin includes hyphen­ation pat­terns for over 40 lan­guages. Please make sure your website’s pri­mary lan­guage is selected. wp-​​Typography pref­er­ences can be set in the Word­Press admin sec­tion under Settings > wp-Typography.

What hyphen­ation lan­guage pat­terns are included?
wp-​​Typography has multi-​​language sup­port. Pat­tern libraries are included for:
  • Basque,
  • Bul­gar­ian,
  • Cata­lan,
  • Chi­nese Pinyin (Latin),
  • Croa­t­ian,
  • Czech,
  • Dan­ish,
  • Eng­lish (United Kingdom),
  • Eng­lish (United States),
  • Eston­ian,
  • Finnish,
  • French,
  • Gali­cian,
  • Ger­man,
  • Greek (Ancient),
  • Greek (Mod­ern Monotonic),
  • Greek (Mod­ern Polytonic),
  • Hun­gar­ian,
  • Ice­landic,
  • Indone­sian,
  • Inter­lin­gua,
  • Irish,
  • Ital­ian, Latin,
  • Lithuan­ian,
  • Mon­go­lian (Cyrillic),
  • Nor­we­gian,
  • Pol­ish,
  • Por­tuguese,
  • Roman­ian,
  • Russ­ian,
  • San­skrit,
  • Ser­bian (Cyrillic),
  • Ser­bocroa­t­ian (Cyrillic),
  • Ser­bocroa­t­ian (Latin),
  • Slo­vak,
  • Sloven­ian,
  • Span­ish,
  • Swedish,
  • Turk­ish,
  • Ukrain­ian, and
  • Welsh.
Why hyphen­ate?
Hyphen­ation increases the visual appeal of your web­site. When jus­ti­fy­ing text with­out hyphen­ation, word spac­ing is dis­tract­ingly large. With left-​​aligned text, the right edge will be unnec­es­sar­ily ragged.
How does hyphen­ation work?

The soft-​​hyphen is an invis­i­ble char­ac­ter that com­mu­ni­cates to web browsers allow­able line breaks within words. When a web browser wraps a line at a soft-​​hyphen, a hyphen is shown at line’s end.

Sim­i­lar to the soft-​​hyphen, the zero-​​space char­ac­ter com­mu­ni­cates allow­able line breaks within strings of text. But unlike the soft-​​hyphen, it does not show a hyphen at line’s end. This is ideal for forc­ing con­sis­tent wrap­ping of long URLs. It also can be used to force line breaks in unco­op­er­a­tive web browsers after hard-​​hyphens in words like “zero-​​space” and “soft-​​hyphen”.

Which browsers sup­port hyphenation?

Not all browsers sup­port online hyphen­ation. Notably, before ver­sion 3, Fire­fox did not sup­port hyphen­ation. For­tu­nately, it failed grace­fully — hyphen­ated text dis­played as if it was unhyphenated.

That is more than could be said for early ver­sions of Safari (1.2 and ear­lier). Those ver­sions of Safari dis­played a hyphen at every pos­si­ble hyphen­ation point — even if it was not at line’s end. wp-​​Typography includes an option to strip all hyphen­ation from early ver­sion of Safari using JavaScript.

Start­ing with Inter­net Explorer 6, Fire­fox 3, Safari 2, and Opera 8, all major web browsers have offered full sup­port for online hyphenation.

It depends on the search engine. Google and Yahoo prop­erly han­dle the soft-​​hyphen char­ac­ter. Microsoft and Ask improp­erly treat soft-​​hyphens as word breaks. For­tu­nately, Google and Yahoo com­prise more than 90% of the search market.

Because Word­Press search queries the data­base – and hyphen­ation is not stored to the data­base – local search is not affected.

Can I con­trol how a spe­cific word is hyphenated?
Yes. The admin­is­tra­tive panel for wp-​​Typography includes an editable excep­tions list.
What hyphen­ation algo­rithm is used?

The hyphen­ation algo­rithm used by wp-​​Typography is based on the 1983 Stan­ford Ph.D. the­sis of pro­fes­sor Frank Liang: Word Hy-​​phen-​​a-​​tion by Com-​​puter. In this the­sis, Dr. Liang also devel­oped an Eng­lish (United States) pat­tern file for use with his algo­rithm. Liang’s Eng­lish pat­tern file was updated in 1991 by Peter Breitenlohner.

The result­ing algo­rithm – with the Eng­lish (United States) pat­terns – finds 90% of all allowed hyphen­ation points iden­ti­fied in the Webster’s Unabridged Dic­tio­nary with a 0% error rate. Pat­terns for many addi­tional lan­guages have been devel­oped by oth­ers and vary in quality.

Fea­tures

What are wid­ows and why pro­tect them?

A widow is the final word in a block of text that falls to its own line. Espe­cially if the widow is only a few char­ac­ters long, she can get lonely. wp-​​Typography will try to pro­tect wid­ows by bring­ing them com­pany from the pre­vi­ous line.

There is dan­ger that the widow’s com­pany will leave the pre­vi­ous line with less than opti­mal word spac­ing. The risk is less if your text is left-​​aligned, but if it is jus­ti­fied, tread care­fully. The pro­tec­tion of wid­ows is com­pletely cus­tomiz­able in the admin­is­tra­tive options.

Do you plan on offer­ing drop-​​cap capabilities?

No. The gen­eral phi­los­o­phy of this plu­gin is to enable func­tion­al­ity that is oth­er­wise unavail­able using standards-​​based web design. Drop caps can be imple­mented using CSS. Here is an example:



 /* drop cap via kingdesk.com */
.mainContent > .header + p:first-letter {
	/* assumes paragraph line-height is 20px and font-size is 14px */
	display: block;
	float: left;
	margin: 0 2px 0 0;
	padding: 6px 0 0; /* for Firefox: (line-height - font-size) */
	font-size: 70px; /* (3.5 * line-height) */
	line-height: 49px; /* for Safari: (3 * line-height - 11px) */
	text-transform: uppercase;
	vertical-align: top;
}

Class names and dimen­sions will need to be adjusted to your spe­cific application.

Per­for­mance

Will this plu­gin slow my page load­ing times?
Yes. Use WP Super Cache.
Why does this plu­gin fil­ter con­tent at page load? Wouldn’t it be more effi­cient to do it when post is saved?

There are a few reasons:

  1. If I processed at the time of sav­ing a post, the changes are destruc­tive. This means:
    • If peo­ple to back to edit their work, there will be a mul­ti­tude of hid­den char­ac­ters that will inter­fere with their efforts
    • Spell check would be bro­ken (in browsers like Firefox)
    • If you dis­able the plu­gin, the changes are still hard­coded, and will not go away.
  2. Changes would only apply to posts saved after the plu­gin was enabled (not on pre­vi­ous posts, since they have already been saved, and thus would not trig­ger the typo­graphic filtering).
  3. Set­tings would not be editable – since pre­vi­ous fil­ter­ing is stored in the data­base, if you turned off hyphen­ation, that would only apply to new posts saved.
  4. For most instal­la­tions, caching resolves per­for­mance issues.

But to be hon­est, the biggest rea­son is if there is a bug in my code, I don’t want to be respon­si­ble for destroy­ing data in the thou­sands of web­sites that use this plu­gin. If some­thing goes wrong, they can just turn it off – no dam­age done.

Other Ques­tions

Can I develop a hyphen­ation pat­tern file for another language?
Per­haps. wp-​​Typography uses a deriv­a­tive of hyphen­ation pat­terns devel­oped for the TeX plat­form. Here is a col­lec­tion of many of the avail­able TeX hyphen­ation pat­tern files. You will need to find a file for the lan­guage you wish to address. Next, look in the source code for wp-​​Typography at /php-Typography/lang_unformatted/template.txt, the spe­cific needs of lan­guage spe­cific hyphen­ation pat­terns for this plu­gin, and how to con­vert them from the orig­i­nal TeX pat­terns are detailed there. If a TeX pat­tern does not exist, I sup­pose you could cre­ate one, but I don’t know where to direct you.
Can I port this plu­gin to another CMS?
Yes. In fact, We have done most of the work for you. I have sep­a­rated all of the core func­tion­al­ity of wp-​​Typography into a stand-​​alone project — PHP Typog­ra­phy — that is eas­ily ported to any other PHP based con­tent man­age­ment sys­tem. There is even detailed doc­u­men­ta­tion of the PHP Typog­ra­phy functionality.
Can I make a dona­tion to sup­port this plugin?
No. We don’t want your money. If you want to show your sup­port, we would greatly appre­ci­ate a link to king​desk​.com from your web­site — per­haps with a nice review of this plu­gin. We would also greatly appre­ci­ate a 5-​​star rat­ing for this plu­gin in the Word­Press Plu­gin Direc­tory.