WordPress:Fun Character Entities

来自站长百科
Seadragon530讨论 | 贡献2008年4月16日 (三) 15:58的版本
跳转至: 导航、​ 搜索

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:

[[WordPress:#Character Entities or Extended Characters|« « Previous Post Title]]    |    [[WordPress:#Character Entities or Extended Characters|Next Post Title » » ]]

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站点上,你可以看到单个的符号有时突然出现。通常这些符号出现在导航连接上。举个例子,看这个例子中的书名号(«)(»)

[[WordPress:#Character Entities or Extended Characters|« « Previous Post Title]]    |    [[WordPress:#Character Entities or Extended Characters|Next Post Title » » ]]

这些符号叫做HTML 文字实体或者叫做扩展文字.它们是通过一些网页上看起来很奇怪的,浏览器认为是符号的代码生成的。

The code that generated the above example looks like this:

<?php previous_post('&laquo; &laquo; %', '', 'yes'); ?>
| <?php next_post('% &raquo; &raquo; ', '', 'yes'); ?>

生成上述例子的代码如下:

<?php previous_post('&laquo; &laquo; %', '', 'yes'); ?>
| <?php next_post('% &raquo; &raquo; ', '', 'yes'); ?>

Some of the most popular HTML character entities are:

一些最流行的HTML 文字实体为:

&raquo;     »     double right angle quote
&laquo;     «      double left angle quote
&lt;     <      single left arrow
&gt;     >      single right arrow
&bull;     •      bullet
&#9829;     or     &hearts;      ♥      black heart
&#9830;   or   &diams;     ♦    black diamond
&#9827;   or   &clubs;   ♣    black clubs (shamrock)
&#9824;   or   &spades;     ♠      black spade
&#8734;    ∞      infinity symbol
&mdash;    —      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(' &hearts; ') ?>
WordPress ♥ Computers ♥ Internet News

在这个例子中,特殊的文字实体心形()符号把WordPress, 电脑和网络新闻 分类分开来:

<?php the_category(' &hearts; ') ?>
WordPress ♥ Computers ♥ Internet News

In this example you see the use of an accent in your post's title:

<?php the_title('&#8734; ', ' &#8734;'); ?> 
∞ WordPress Makes Me Smile ∞

这个离子中你可以看到文章标题中使用的其中一种符号:

<?php the_title('&#8734; ', ' &#8734;'); ?> 
∞ WordPress Makes Me Smile ∞

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">&diams; <?php the_author(); ?></div>
♦ Harriet Smith

如果你想要把文章作者高亮显示,你不用在WordPress模板标签中使用文字实体,你可以使用以下代码:

<div id="author">&diams; <?php the_author(); ?></div>
♦ Harriet Smith

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.

如同你所看到的,在你的站点中有很多文字实体的使用。你可以实验,然后找到更多创造性的方法来使用这些符号做好你的设计!

注意:不是所有的模板标签可以使用文字实体,尤其是那些使用布尔参数标签。测试一个模板标签 thoroughly,确认它可以接受这种符号。


Character Entities Resources

文字实体资源