WordPress:Fun Character Entities
Character Entities or Extended Characters
In many WordPress sites, you will see odd symbols that will pop up from time to time. Often these symbols appear in navigation links. For instance, look at the the double left angle quotes («) and the double right angle quotes (») in this example:
These symbols are called HTML character entities or extended characters. They are generated by strange looking code on the web page that the web browser interprets as symbols.
文字实体或者扩展文字
在许多WordPress站点上,你可以看到单个的符号有时突然出现。通常这些符号出现在导航连接上。举个例子,看这个例子中的书名号(«)和(»):
这些符号叫做HTML 文字实体或者叫做扩展文字.它们是通过一些网页上看起来很奇怪的,浏览器认为是符号的代码生成的。
The code that generated the above example looks like this:
<?php previous_post('« « %', '', 'yes'); ?> | <?php next_post('% » » ', '', 'yes'); ?>
生成上述例子的代码如下:
<?php previous_post('« « %', '', 'yes'); ?> | <?php next_post('% » » ', '', 'yes'); ?>
Some of the most popular HTML character entities are:
一些最流行的HTML 文字实体为:
- » » double right angle quote
- « « double left angle quote
- < < single left arrow
- > > single right arrow
- • • bullet
- ♥ or ♥ ♥ black heart
- ♦ or ♦ ♦ black diamond
- ♣ or ♣ ♣ black clubs (shamrock)
- ♠ or ♠ ♠ black spade
- ∞ ∞ infinity symbol
- — — long dash
Using Character Entities in WordPress
Using character entities can be a fun part of your design! You can use these special accents with template tags such as the the_category() tag. Note: the_category() template tag lists, in post meta data section, the various categories assigned to a post.
在WordPress中使用文字实体
使用文字实体是设计中一个有趣的部分!你可以在模板标签中使用这些特殊符号,如the_category()标签。注意:the_category() 模板标签列表,在文章meta数据 部分,多种分类指定为文章。
In this example, the special character entity, the heart (♥) symbol, separates the categories of WordPress, Computers, and Internet News:
<?php the_category(' ♥ ') ?>
在这个例子中,特殊的文字实体心形(♥)符号把WordPress, 电脑和网络新闻 分类分开来:
<?php the_category(' ♥ ') ?>
In this example you see the use of an accent in your post's title:
<?php the_title('∞ ', ' ∞'); ?>
这个离子中你可以看到文章标题中使用的其中一种符号:
<?php the_title('∞ ', ' ∞'); ?>
If you want to highlight the post's author, you don't have to use a character entity inside of a WordPress template tag. You can use it in the text.
<div id="author">♦ <?php the_author(); ?></div>
如果你想要把文章作者高亮显示,你不用在WordPress模板标签中使用文字实体,你可以使用以下代码:
<div id="author">♦ <?php the_author(); ?></div>
As you have seen, there are a many uses for character entities within your site. With this information you can experiment and find creative ways to use these symbols in your design!
- Note: Not all template tags can use character entities, especially those tags that use boolean parameters. Test a template tag thoroughly to be sure that it will accept the symbols.
如同你所看到的,在你的站点中有很多文字实体的使用。你可以实验,然后找到更多创造性的方法来使用这些符号做好你的设计!
Character Entities Resources
- ASCII HTML Codes
- Microsoft Developer’s HTML Character Sets
- Digital Web Magazine’s Extended ASCII Characters for HTML
- University of Texas - Special and Extended Characters
- Browser Support for Extended Characters
- Chami’s Tips: HTML Special Character Reference
- The Unicode Consortium site