Skip to content

Melindrea/wp-typography

Repository files navigation

wp-Typography

Contributors: kingjeffrey, melindrea
Donate link: http://kingdesk.com/projects/donate/
Tags: typography, typogrify, hyphenation, SmartyPants, widow, widon't, units, wrapping, wrap, URLs, Email, formatting, smart quotes, quote marks, dashes, em dash, en dash, ellipses, trademark, copyright, service mark, fractions, math, math symbols, ordinal suffixes, ordinal, CSS hooks, ampersands, uppercase, numbers, guillemets, text, smartypants, format, style, quotes, prettify, type, font, admin, automatic, comment, comments, content, headings, heading, CSS, custom, excerpt, feed, feeds, RSS, filter, links, page, pages, plugin, post, posts, title, wordpress, XHTML
Requires at least: 2.7
Tested up to: 3.4.2
Stable tag: 3.0.4

Improve your web typography with: hyphenation, space control, intelligent character replacement, and CSS hooks.

Description

Improve your web typography with:

  • Hyphenation — over 40 languages supported

  • Space control, including:

    • widow protection
    • gluing values to units
    • forced internal wrapping of long URLs & email addresses
  • Intelligent character replacement, including smart handling of:

    • quote marks
    • dashes
    • ellipses
    • trademarks, copyright & service marks
    • math symbols
    • fractions
    • ordinal suffixes
  • CSS hooks for styling:

    • ampersands,
    • uppercase words,
    • numbers,
    • initial quotes & guillemets.

wp‐Typography has the following requirements:

  • the host server must run PHP 5 or later
  • your installation of PHP 5 must include the mbstring extension (most do)
  • text must be encoded UTF‐8
  • all markup must be valid xHTML syntax, specifically:
    • every element must be closed
    • every attribute must have a value enclosed in quotes
    • tag names and attributes must be lowercase

wp-Typography can easily be ported to any other PHP based content management system. A sister project — PHP Typography assembles all typographic functionality (without any WordPress specific code) in an object oriented format that is ready for WordPress independent use.

View the wp-Typography homepage for more information.

Installation

  1. Log in to WordPress as an administrator
  2. Go to Plugins > Add New and search for wp-Typography
  3. Click install next to the wp-Typography plugin description
  4. Click the Install Now button in the pop-up window
  5. After the plugin is installed, click the Activate Plugin link
  6. Go to Settings > wp-Typography to set your preferences

Alternately, you may manually upload the plugin by following the following instructions:

  1. Go to http://wordpress.org/extend/plugins/wp-typography/, and click the Download button
  2. Unzip the wp-Typography.x.x.zip file
  3. Using your favored FTP client, upload the wp-typography folder to the /wp-content/plugins/ directory
  4. Log in to WordPress as an administrator
  5. Go to Plugins > Installed, locate the plugin and click the related Activate link.
  6. Go to Settings > wp-Typography to set your preferences

Frequently Asked Questions

FAQs are maintained at the wp-Typography website.

Three questions come up so frequently, we will republish their answers here:

Will this plu­gin slow my page load­ing times?

Yes. Use WP Super Cache.

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 using the_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.

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 h1 and h2 to 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 (as of version 2.8.1) 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.

Does this plugin work with wp-Typogrify?

This plugin is an official replacement for the wp-Typogrify plugin. Please uninstall wp-Typogrify and install wp-Typography in its place.

Remember, many more FAQs are are addressed the wp-Typography website.

Screenshots

  1. wp-Typography administrative settings page

Changelog

3.0.0 - December 8th, 2012

  • Updating class name so that it does not clash with WP-Markdown
  • Changing readme.txt to README.md
  • Fixing a few other things that were throwing errors
  • Branching this onto Github

2.0.4 - January 4, 2011

  • An errant "settings" link was being injected into the "Plugins" page. It has been removed.

2.0.3 - January 3, 2011

  • Removed "text-rendering: optimizeLegibility;" from the plugin's default CSS rules as a bug in Chrome with this statement causes all soft-hyphens to be displayed throughout the text. This will only correct the settings in new downloads. So, if you have an older version installed, remove the "* {text-rendering: optimizeLegibility;}" statement from the "Styling for CSS Hooks" textarea in this plugin's options page (the very last field).

2.0.2 - July 16, 2010

  • Rolled back application of wp-Typography's title filter to bloginfo('name') and bloginfo('description') to resolve conflicts introduced with RSS feeds

2.0.1 - July 14, 2010

  • Applied wp-Typography's title filter to bloginfo('name') and bloginfo('description')
  • Prevented processing of wp_title() and wp_post_title() so that HTML tags do not appear in page title

2.0 - July 7, 2010

  • Simplified acronym identification to not include some obscure uppercase characters. This will reduce support for some non-English languages, but it resolves an issue of catastrophic failure (where the entire page fails to load) with certain server configurations.
  • Security Fix: Prevented comments with exceptionally long strings from causing fatal PHP error.
  • Added *{text-rendering: optimizeLegibility;} to default CSS rules to enable kerning and ligatures in supported browsers. Note this will not appear for upgrades, only new installs
  • Upgraded to PHP Typography 2.0

1.22 - March 4, 2010

  • Fixed bug that caused occasional hyphenation errors for non-English languages.
  • Upgraded to PHP Typography 1.22

1.21.1 - January 22, 2010

  • Deepened font stacks on admin page – some special characters were not displaying on certain system configurations

1.21 - December 31, 2009

1.20 - December 20, 2009

  • Verified compatible with WordPress 2.9
  • Resolved uninitialized variable
  • Added HTML5 elements to parsing algorithm for greater contextual awareness
  • Upgraded to PHP Typography 1.20

1.19 - December 1, 2009

  • Fixed bug where dewidow functionality would add broken no-break spaces to the end of texts, and smart_exponents would drop some of the resulting text.
  • Declared encoding in all instances of mb_substr to avoid conflicts
  • Corrected a few instances of undeclared variables.
  • Upgraded to PHP Typography 1.19

1.18 - November 10, 2009

1.17 - November 9, 2009

1.16 - November 4, 2009

  • Added automated diacritic replacements (i.e. "creme brulee" becomes "crème brûlée").
  • Improved smart quotes and smart dashes with sensitivity to adjacent diacritic characters.
  • Upgraded to PHP Typography 1.16

1.15 - October 21, 2009

  • Replaced quotation language styles with individual selection of primary and secondary quotation styles. NOTE: this change requires reselection of quotation styles for anyone using non-English preferences.
  • Tested for WordPress version 2.8.5 compatibility.
  • Upgraded to PHP Typography 1.15

1.14 - September 8, 2009

  • Improved space collapse functionality.
  • Corrected bug in smart quote and single character word handling where the "0" character may be improperly duplicated
  • Upgraded to PHP Typography 1.14

1.13.1 - August 31, 2009

  • Clarified requirement for PHP mbstring extension, and refined a test upon installation of the plugin to catch incapable server environments.
  • Corrected default hyphenation language pattern to English (United States).

1.13 - August 31, 2009

  • Added option to collapse adjacent space characters to a single character
  • Upgraded to PHP Typography 1.13

1.12 - August 17, 2009

  • Corrected multibyte character handling error that could cause some text to not display properly
  • Upgraded to PHP Typography 1.12

1.11 - August 14, 2009

  • Added language specific quote handling (for single quotes, not just double) for English, German and French quotation styles
  • Upgraded to PHP Typography 1.11

1.10.1 - August 14, 2009

  • Left a setting in test mode. That is corrected.

1.10 - August 14, 2009

  • Fixed typo in default CSS styles
  • Added language specific quote handling for English, German and French quotation styles
  • Corrected multibyte character handling error that could cause some text to not display properly
  • Expanded the multibyte character set recognized as valid word characters for improved hyphenation
  • Upgraded to PHP Typography 1.10

1.9 - August 12, 2009

  • Added option to force single character words to wrap to new line (unless they are widows).
  • Upgraded to PHP Typography 1.9

1.8.1 - August 7, 2009

  • Added optional automatic inclusion of styling of CSS hooks
  • Fixed "Restore Defaults" conflict with other plugins

1.8 - August 4, 2009

  • Corrected math and dash handling of dates
  • Styling of uppercase words now plays nicely with soft-hyphens
  • Upgraded to PHP Typography 1.8

1.7.2 - July 29, 2009

  • Now WordPress MU compatible
  • Updated Options Page to new register_setting() and settings_fields() API

1.7.1 - July 29, 2009

  • Updated thin space handling to be off by default, and updated the description in the admin panel to warn of rare mishandling in Safari and Chrome.

1.7 - July 29, 2009

  • Reformatted language files for increased stability and to bypass a false positive from Avira's free antivirus software
  • Upgraded to PHP Typography 1.7

1.6 - July 28, 2009

  • Efficiency Optimizations ( approximately 25% speed increase )
  • Upgraded to PHP Typography 1.6

1.5 - July 27, 2009

  • Added the ability to exclude hyphenation of capitalized (title case) words to help protect proper nouns
  • Added Hungarian hyphenation patterns
  • Upgraded to PHP Typography 1.5

1.4 - July 23, 2009

  • Fixed an instance where pre-hyphenated words were hyphenated again
  • Upgraded to PHP Typography 1.4

1.3 - July 23, 2009

  • Removed two uses of create_function() for improved performance
  • Corrected many uninitialized variables
  • Corrected two variables that were called out of scope
  • Upgraded to PHP Typography 1.3

1.2 - July 23, 2009

  • added new 100 character option for max widow length protected
  • added new 100 character option for max pull length for widow protection
  • moved the processing of widow handling after hyphenation so that max-pull would not be compared to the length of the adjacent word, but rather the length of the adjacent word segment (i.e. that after a soft hyphen)
  • Upgraded to PHP Typography 1.2

1.1 - July 22, 2009

  • took advantage of new feature in PHP Typography 1.1 where we could just set user settings without first setting phpTypography defaults for a slight performance improvement.
  • Decoded special HTML characters (for feeds only) to avoid invalid character injection (according to XML's specs)
  • Upgraded to PHP Typography 1.1

1.0.4 - July 20, 2009

  • Added test for curl to avoid bug where admin panel would not load

1.0.3 - July 17, 2009

  • Reverted use of the hyphen character to the basic minus-hyphen in words like "mother-in-law" because of poor support in IE6
  • Zero-width-space removal for IE6 was broken. This is corrected.
  • Clarified some labels in the admin interface
  • Simplified the admin interface URL

1.0.2 - July 16, 2009

  • Fixed smart math handling so it can be turned off.
  • Corrected smart math handling to not convert slashes in URLs to division signs
  • Corrected issue where some server settings were throwing a warning in the admin panel for use of file_get_contents()

1.0.1 - July 15, 2009

  • Corrected label in admin interface that indicated pretty fractions were part of basic math handling.

1.0 - July 15, 2009

  • Changed default settings from all options being enabled to a minimal set being enabled.
  • Added test to phpTypography methods process() and process_feed() to skip processing if $isTitle parameter is TRUE and h1 or h2 is an excluded HTML tag

1.0 beta 9 - July 14, 2009

  • Added catch-all quote handling, now any quotes that escape previous filters will be assumed to be closing quotes
  • A section of resource links were added to the wp-Typography admin settings page.

1.0 beta 8 - July 13, 2009

  • Changed thin space injection behavior so that for text such as "...often-always?-judging...", the second dash will be wrapped in thin spaces
  • Corrected error where fractions were not being styled because of a zero-space insertion with the wrap hard hyphens functionality
  • Added default class to exclude: noTypo
  • Changed order of admin page options, moving hyphenation options toward the top

1.0 beta 7 - July 10, 2009

  • Added "/" as a valid word character so we could capture "this/that" as a word for processing (similar to "mother-in-law")
  • Corrected error where characters from the Latin 1 Supplement Block were not recognized as word characters
  • Corrected smart quote handling for strings of numbers
  • Added smart guillemet conversion: << and >> to « and »
  • Added smart Single Low 9 Quote conversion as part of smart quotes: comma followed by non-space becomes Single Low 9 Quote
  • Added Single Low 9 Quote, Double Low 9 Quote and » to style_initial_character functionality
  • Added a new phpTypography method smart_math that assigns proper characters to minus, multiplication and division characters
  • Depreciated the phpTypography method smart_multiplication in favor of smart_math
  • Cleaned up some smart quote functionality
  • Added ability to wrap after "/" if set_wrap_hard_hyphen is TRUE (like "this/that")
  • Titles were not being properly processed, this has been corrected

1.0 beta 6 - July 9, 2009

  • Critical bug fix: RSS feeds were being disabled by previous versions. This has been corrected.

1.0 beta 5 - July 8, 2009

  • Corrected error where requiring Em/En dash thin spacing "word-" would become "word –" instead of "word–"
  • Corrected default settings
  • Alphabetically sorted languages returned with get_languages() method
  • Added a "Restore Defaults" option to the admin page

1.0 beta 4 - July 7, 2009

  • Added default encoding value to smart_quote handling to avoid PHP warning messages
  • Disabled processing of category titles using wp_list_categories()

1.0 beta 3 - July 6, 2009

  • Corrected curling quotes at the end of block level elements
  • Disabled processing of page titles (some browsers did not properly handle soft hyphens) reverts to wp-texturize for titles.

1.0 beta 2 - July 6, 2009

  • Corrected multibyte character conflict in smart-quote handling that caused infrequent dropping of text
  • Thin space injection included for en-dashes

1.0 beta 1 - July 3, 2009

  • Initial release