27th Mar 2010Posted in: Software, WordPress Plugins 1


Do you often mix Latin letters and Chinese, Japanese or Korean (CJK) characters in the same post or in the title? Did you find it difficult to style both types of characters satisfactorily using the same CSS style?

CJK-AutoTagger Automatically wraps CJK characters in your site with <span lang=””></span> tags, so that you can style them separately. You can choose what to <span>-wrap (refer to the screen shot) and what language code to use.

To style CJK and non-CJK (usually Latin) characters separately, follow the example below:

// Style non-CJK characters
#content {
  font-family: Arial, Verdana;
  font-size: 12px;
// Style CJK characters
#content:lang(zh-HK) {
  font-family: “Microsoft JhengHei”, “MingLiu”;
  font-size: 14px;

For more information on styling with language codes, check out this reference from W3C.

Advanced Usage

For advanced users: to auto-detect and <span>-wrap your custom strings in templates, use the following function:

string cjk_autotagger( string $string [, string $lang_code ] )


echo cjk_autotagger($str, “zh-HK”);


  1. Upload the directory cjk-autotagger to the /wp-content/plugins/ directory
  2. Activate the plugin through the ‘Plugins’ menu in WordPress
  3. Configure your plugin on the CJK-AutoTagger setting page under Settings


CJK-AutoTagger Setting page.

Download (46 downloads)

Related Posts

One Response

  1. DJB says:

    Hi Thomas,

    I am trying to display Japanese on my blog using your CJK-AutoTagger, with no success so far.
    – My WordPress UI is in English, but I have “Settings/Reading/Encoding for pages and feeds” set to “UTF-8″.
    – CJK-AutoTagger is installed and “Language code” is set to “ja: Japanese” from the pulldown menu.
    – In addition I tried adding the “// Style CJK characters” code to my style.css (with J font names), but that accomplished nothing.

    If you can offer any advice, it would be appreciated, thanks.

    – DJB in Japan

Leave a Reply