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 ins...) |
无编辑摘要 |
||
(未显示另一用户的1个中间版本) | |||
第1行: | 第1行: | ||
= | =文字实体或者扩展文字= | ||
在许多WordPress站点上,你可以看到单个的符号有时突然出现。通常这些符号出现在导航连接上。举个例子,看这个例子中的书名号'''(«)'''和'''(»)''': | |||
<div style="border:1px solid blue; width:50%; margin:20px; padding:20px">[[WordPress: | <div style="border:1px solid blue; width:50%; margin:20px; padding:20px">[[#WordPress:Character Entities or Extended Characters|« « Previous Post Title]] | [[#WordPress:Character Entities or Extended Characters|Next Post Title » » ]]</div> | ||
这些符号叫做'''[[WordPress:Glossary#HTML|HTML]] 文字实体'''或者叫做'''扩展文字'''.它们是通过一些网页上看起来很奇怪的,浏览器认为是符号的代码生成的。 | |||
生成上述例子的代码如下: | |||
<pre><?php previous_post('&laquo; &laquo; %', '', 'yes'); ?> | <pre><?php previous_post('&laquo; &laquo; %', '', 'yes'); ?> | ||
| <?php next_post('% &raquo; &raquo; ', '', 'yes'); ?></pre> | | <?php next_post('% &raquo; &raquo; ', '', 'yes'); ?></pre> | ||
一些最流行的[[WordPress:Glossary#HTML|HTML]] ''文字实体''为: | |||
<div style="font-size:110%"> | <div style="font-size:110%"> | ||
第26行: | 第26行: | ||
</div> | </div> | ||
= | =在WordPress中使用文字实体= | ||
使用''文字实体''是设计中一个有趣的部分!你可以在[[WordPress:Template Tags|模板标签]]中使用这些特殊符号,如[[WordPress:Template Tags/the_category|<tt>the_category()</tt>]]标签。注意:[[WordPress:Template Tags/the_category|<tt>the_category()</tt>]] [[WordPress:Template Tags|模板标签]]列表,在[[WordPress:Post Meta Data Section|''文章meta数据'']] 部分,多种[[WordPress:Glossary#Category|分类]]指定为[[WordPress:Glossary#Post|文章]]。 | |||
在这个例子中,特殊的''文字实体''心形('''♥''')符号把WordPress, 电脑和网络新闻 [[WordPress:Glossary#Category|分类]]分开来: | |||
<pre><?php the_category(' &hearts; ') ?></pre> | <pre><?php the_category(' &hearts; ') ?></pre> | ||
第35行: | 第36行: | ||
<div style="font-size: 105%; color: blue; font-weight:bold; margin:20px; padding: 20px; border:solid 1px blue">WordPress ♥ Computers ♥ Internet News</div> | <div style="font-size: 105%; color: blue; font-weight:bold; margin:20px; padding: 20px; border:solid 1px blue">WordPress ♥ Computers ♥ Internet News</div> | ||
这个例子中你可以看到[[WordPress:Template Tags/the_title|文章标题]]中使用的其中一种符号: | |||
<pre><?php the_title('&#8734; ', ' &#8734;'); ?> </pre> | <pre><?php the_title('&#8734; ', ' &#8734;'); ?> </pre> | ||
第41行: | 第42行: | ||
<div style="font-size: 120%; color: blue; font-weight:bold; margin:20px; padding: 20px; border:solid 1px blue">∞ WordPress Makes Me Smile ∞</div> | <div style="font-size: 120%; color: blue; font-weight:bold; margin:20px; padding: 20px; border:solid 1px blue">∞ WordPress Makes Me Smile ∞</div> | ||
如果你想要把[[WordPress:Template Tags/the_author|文章作者]]高亮显示,你不用在WordPress模板标签中使用文字实体,你可以使用以下代码: | |||
<pre><div id="author">&diams; <?php the_author(); ?></div></pre> | <pre><div id="author">&diams; <?php the_author(); ?></div></pre> | ||
第47行: | 第48行: | ||
<div style="color: blue; font-weight:bold; margin:20px; padding: 20px; border:solid 1px blue">♦ Harriet Smith</div> | <div style="color: blue; font-weight:bold; margin:20px; padding: 20px; border:solid 1px blue">♦ Harriet Smith</div> | ||
如同你所看到的,在你的站点中有很多''文字实体''的使用。你可以实验,然后找到更多创造性的方法来使用这些符号做好你的设计! | |||
::'''注意:'''不是所有的[[WordPress:Template_Tags|模板标签]]可以使用''文字实体'',尤其是那些使用[[WordPress:Template_Tags/How_to_Pass_Tag_Parameters#Boolean|布尔参数]]的[[WordPress:Template_Tags|标签]]。测试一个[[WordPress:Template_Tags|模板标签]] '''thoroughly''',确认它可以接受这种符号。 | |||
== | ==文字实体资源== | ||
* [http://www.ascii.cl/htmlcodes.htm ASCII HTML | * [http://www.ascii.cl/htmlcodes.htm ASCII HTML 代码] | ||
* [http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/charsets/charsets.asp Microsoft Developer’s HTML | * [http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/charsets/charsets.asp Microsoft Developer’s HTML 字符集] | ||
* [http://www.digital-web.com/articles/extended_ascii_characters_for_html/ | * [http://www.digital-web.com/articles/extended_ascii_characters_for_html/ 数字网页杂志’s HTML扩展 ASCII 文字] | ||
* [http://www.utexas.edu/learn/html/spchar.html | * [http://www.utexas.edu/learn/html/spchar.html 德州大学 – 特殊和扩展文字] | ||
* [http://www.fjordaan.uklinux.net/moveabletype/fblog/archives/000063.html | * [http://www.fjordaan.uklinux.net/moveabletype/fblog/archives/000063.html 扩展文字的浏览器支持] | ||
* [http://www.chami.com/tips/internet/050798I.html Chami’s | * [http://www.chami.com/tips/internet/050798I.html Chami’s 小提示: HTML特殊文字参考] | ||
* [http://unicode.org/ | * [http://unicode.org/ Unicode 联盟站点] |
2008年4月17日 (四) 15:41的最新版本
文字实体或者扩展文字[ ]
在许多WordPress站点上,你可以看到单个的符号有时突然出现。通常这些符号出现在导航连接上。举个例子,看这个例子中的书名号(«)和(»):
这些符号叫做HTML 文字实体或者叫做扩展文字.它们是通过一些网页上看起来很奇怪的,浏览器认为是符号的代码生成的。
生成上述例子的代码如下:
<?php previous_post('« « %', '', 'yes'); ?> | <?php next_post('% » » ', '', 'yes'); ?>
一些最流行的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
在WordPress中使用文字实体[ ]
使用文字实体是设计中一个有趣的部分!你可以在模板标签中使用这些特殊符号,如the_category()标签。注意:the_category() 模板标签列表,在文章meta数据 部分,多种分类指定为文章。
在这个例子中,特殊的文字实体心形(♥)符号把WordPress, 电脑和网络新闻 分类分开来:
<?php the_category(' ♥ ') ?>
WordPress ♥ Computers ♥ Internet News
这个例子中你可以看到文章标题中使用的其中一种符号:
<?php the_title('∞ ', ' ∞'); ?>
∞ WordPress Makes Me Smile ∞
如果你想要把文章作者高亮显示,你不用在WordPress模板标签中使用文字实体,你可以使用以下代码:
<div id="author">♦ <?php the_author(); ?></div>
♦ Harriet Smith
如同你所看到的,在你的站点中有很多文字实体的使用。你可以实验,然后找到更多创造性的方法来使用这些符号做好你的设计!