- Things Are Broken!
- Hyphenation Generally
- Why are words hyphenated incorrectly or not at all?
- What hyphenation language patterns are included?
- Why hyphenate?
- How does hyphenation work?
- Which browsers support hyphenation?
- Does hyphenation effect search?
- Can I control how a specific word is hyphenated?
- What hyphenation algorithm is used?
- Features
- Performance
- Other Questions
Things Are Broken
- This plugin breaks post title links. What gives?
-
More likely than not, your WordPress theme is using an improper function to set the title attribute of your heading’s link. It is probably using the
the_title()function, which delivers the post title after filtering. It should be usingthe_title_attribute()which delivers the post title before filtering. Change out this function throughout your theme when it is used inside of an HTML tag, and the problem should go away.Here are some specific instructions for fixing your theme. Please note that every theme is different, so mileage may vary.
To edit the theme, log in as an administrator and go to: Appearance > Editor. You will typically want to edit the following files (if they exist):
- archive.php
- index.php
- page.php
- search.php
- single.php
In each file, search for the code that looks something 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 contain some variations. For instance, the h2 tags may be h1 or h3… We are looking specifically 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 uncomfortable editing your theme’s code, you may alternatively go to the wp-Typography settings page in your admin panel and add
h1andh2to the “Do not process the content of these HTML elements:” field. This will disable typographic processing within improperly designed page title links and page titles.There is an error in the core of WordPress (confirmed in version 2.8.2) that uses the wrong function to provide post titles for secondary RSS feeds (like RSS feeds for single page comments or categories. This error will return any HTML tags used for CSS Hooks or character styling, and the tags will be visible when someone clicks on the RSS icon in the address bar of their browser. If this bothers you, your only option (until WordPress corrects this error) is to disable all typographic processing in your page titles as described in the paragraph above. Updates on this WordPress bug may be followed here.
- Why does filtering by HTML element, class or id not prevent processing?
- wp-Typography does not have access to HTML stored in your theme files. It only has access to the content passed to it (i.e. post Title and Content); it is unable to determine the greater contextual awareness. If you try to filter processing based on a class of the body element – as an example – nothing will happen. wp-Typography does not see the body element. wp-Typography does filter by HTML element, class or id for any markup present within the parsed content. So if you do not want class
noTypoprocessed, filtering will only occur within the title or content of your post or page. - Is this plugin infected with a virus?
- Avira’s free anti-virus program “AntiVir” incorrectly asserted early versions of this plugin as contained the “HTML/ADODB.Exploit.Gen” exploit in several of the language hyphenation pattern files. The problem was reported to Avira, but they provided no feedback for nearly a month. After some experimentation, we were able to reformat the affected files to avoid the false positive. As of version 1.7 of the plugin, this problem is no longer present.
- Why is copy-and-paste not working properly on my site?
This is a known compromise that comes with hyphenation. The hyphenation feature works by inserting soft-hyphen characters at every possible hyphenation point. They are typically invisible, and should only show up at the end of a line if the word wraps.
Unfortunately, not every editor is smart enough to properly handle soft hyphens. Text copied from your web page will include soft hyphen characters. Some programs will display a space instead of a soft hyphen. Some may display actual hyphens. And it may break spell check even if the characters are displayed correctly. If you want hyphenation on the web, you must use soft hyphens. If you use soft hyphens, other programs may not like copied text.
- Why are opening quotes not being styled?
-
This plugin offers an option to wrap initial quotes in a span of class
quoordquo. You can then style these classes in your CSS Stylesheet. This is useful if you want to – for example – negatively indent quotes so the quote hangs in the left margin and the text is aligned with the text below.Please note, this applies only to initial quotes – quotemarks that appear as the first character of a block of text (like a paragraph or blockquote). This does not apply to all opening quotes.
Hyphenation Generally
- Why are words hyphenated incorrectly or not at all?
This plugin includes hyphenation patterns for over 40 languages. Please make sure your website’s primary language is selected. wp-Typography preferences can be set in the WordPress admin section under
Settings > wp-Typography.- What hyphenation language patterns are included?
- wp-Typography has multi-language support. Pattern libraries are included for:
- Basque,
- Bulgarian,
- Catalan,
- Chinese Pinyin (Latin),
- Croatian,
- Czech,
- Danish,
- English (United Kingdom),
- English (United States),
- Estonian,
- Finnish,
- French,
- Galician,
- German,
- Greek (Ancient),
- Greek (Modern Monotonic),
- Greek (Modern Polytonic),
- Hungarian,
- Icelandic,
- Indonesian,
- Interlingua,
- Irish,
- Italian, Latin,
- Lithuanian,
- Mongolian (Cyrillic),
- Norwegian,
- Polish,
- Portuguese,
- Romanian,
- Russian,
- Sanskrit,
- Serbian (Cyrillic),
- Serbocroatian (Cyrillic),
- Serbocroatian (Latin),
- Slovak,
- Slovenian,
- Spanish,
- Swedish,
- Turkish,
- Ukrainian, and
- Welsh.
The soft-hyphen is an invisible character that communicates to web browsers allowable line breaks within words. When a web browser wraps a line at a soft-hyphen, a hyphen is shown at line’s end.
Similar to the soft-hyphen, the zero-space character communicates allowable 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 forcing consistent wrapping of long URLs. It also can be used to force line breaks in uncooperative web browsers after hard-hyphens in words like “zero-space” and “soft-hyphen”.
Not all browsers support online hyphenation. Notably, before version 3, Firefox did not support hyphenation. Fortunately, it failed gracefully — hyphenated text displayed as if it was unhyphenated.
That is more than could be said for early versions of Safari (1.2 and earlier). Those versions of Safari displayed a hyphen at every possible hyphenation point — even if it was not at line’s end. wp-Typography includes an option to strip all hyphenation from early version of Safari using JavaScript.
Starting with Internet Explorer 6, Firefox 3, Safari 2, and Opera 8, all major web browsers have offered full support for online hyphenation.
It depends on the search engine. Google and Yahoo properly handle the soft-hyphen character. Microsoft and Ask improperly treat soft-hyphens as word breaks. Fortunately, Google and Yahoo comprise more than 90% of the search market.
Because WordPress search queries the database – and hyphenation is not stored to the database – local search is not affected.
The hyphenation algorithm used by wp-Typography is based on the 1983 Stanford Ph.D. thesis of professor Frank Liang: Word Hy-phen-a-tion by Com-puter. In this thesis, Dr. Liang also developed an English (United States) pattern file for use with his algorithm. Liang’s English pattern file was updated in 1991 by Peter Breitenlohner.
The resulting algorithm – with the English (United States) patterns – finds 90% of all allowed hyphenation points identified in the Webster’s Unabridged Dictionary with a 0% error rate. Patterns for many additional languages have been developed by others and vary in quality.
Features
- What are widows and why protect them?
-
A widow is the final word in a block of text that falls to its own line. Especially if the widow is only a few characters long, she can get lonely. wp-Typography will try to protect widows by bringing them company from the previous line.
There is danger that the widow’s company will leave the previous line with less than optimal word spacing. The risk is less if your text is left-aligned, but if it is justified, tread carefully. The protection of widows is completely customizable in the administrative options.
- Do you plan on offering drop-cap capabilities?
-
No. The general philosophy of this plugin is to enable functionality that is otherwise unavailable using standards-based web design. Drop caps can be implemented 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 dimensions will need to be adjusted to your specific application.
Performance
- Will this plugin slow my page loading times?
- Yes. Use WP Super Cache.
- Why does this plugin filter content at page load? Wouldn’t it be more efficient to do it when post is saved?
-
There are a few reasons:
- If I processed at the time of saving a post, the changes are destructive. This means:
- If people to back to edit their work, there will be a multitude of hidden characters that will interfere with their efforts
- Spell check would be broken (in browsers like Firefox)
- If you disable the plugin, the changes are still hardcoded, and will not go away.
- Changes would only apply to posts saved after the plugin was enabled (not on previous posts, since they have already been saved, and thus would not trigger the typographic filtering).
- Settings would not be editable – since previous filtering is stored in the database, if you turned off hyphenation, that would only apply to new posts saved.
- For most installations, caching resolves performance issues.
But to be honest, the biggest reason is if there is a bug in my code, I don’t want to be responsible for destroying data in the thousands of websites that use this plugin. If something goes wrong, they can just turn it off – no damage done.
- If I processed at the time of saving a post, the changes are destructive. This means:
Other Questions
- Can I develop a hyphenation pattern file for another language?
- Perhaps. wp-Typography uses a derivative of hyphenation patterns developed for the TeX platform. Here is a collection of many of the available TeX hyphenation pattern files. You will need to find a file for the language you wish to address. Next, look in the source code for wp-Typography at /php-Typography/lang_unformatted/template.txt, the specific needs of language specific hyphenation patterns for this plugin, and how to convert them from the original TeX patterns are detailed there. If a TeX pattern does not exist, I suppose you could create one, but I don’t know where to direct you.
- Can I port this plugin to another CMS?
- Yes. In fact, We have done most of the work for you. I have separated all of the core functionality of wp-Typography into a stand-alone project — PHP Typography — that is easily ported to any other PHP based content management system. There is even detailed documentation of the PHP Typography functionality.
- Can I make a donation to support this plugin?
- No. We don’t want your money. If you want to show your support, we would greatly appreciate a link to kingdesk.com from your website — perhaps with a nice review of this plugin. We would also greatly appreciate a 5-star rating for this plugin in the WordPress Plugin Directory.

