WordPress.org

Ready to get started?Download WordPress

Codex

zh-cn:使用表情符号

Contents

什么是表情?

表情符号是在您写作时帮助表达您情感的符号。它们是为文章增添色彩的好帮手。smile emoticon

通常,表情符号由几个英文标点符号构成。比如:

;-) 等于 微笑
:-) 等于 微笑
:-( 等于 沮丧
:-? 等于 纠结

要了解更多关于表情符号和它们的历史,请参见中文维基百科“表情符号”条目

WordPress 如何处理表情?

WordPress 默认自动将特定文字转换成图形化图片。如,您在文章中输入 ;-),在发布后或预览时就可看到 smile emoticon

关闭图形式表情

若您关闭图形化表情的选项,之后您输入的任何纯文本内容将保持纯文本状态,因此只会显示纯文本。

  1. 前往站点后台
  2. 选择设置 -> 撰写
  3. 格式区域,取消选择"转换如 :-)、:-P 等文字表情符号为图像"的选项

关闭这个选项的效果只是当您在文章中输入 ;-) 时,发布后不转换成图片,而保留 ;-)。这不代表您就不能在文章中以纯文本方式添加表情。wink emoticon

我该打什么才可以出现表情?

Smiley images and the text used to produce them*:

icon text text full text icon full text
smile :) :-) :smile: lol :lol:
biggrin :D :-D :grin: redface :oops:
sad :( :-( :sad: cry :cry:
surprised :o :-o :eek: evil :evil:
eek 8O 8-O :shock: twisted :twisted:
confused :? :-? :???: rolleyes :roll:
cool 8) 8-) :cool: exclaim :!:
mad :x :-x :mad: question :?:
razz :P :-P :razz: idea :idea:
neutral :| :-| :neutral: arrow :arrow:
wink ;) ;-) :wink: mrgreen :mrgreen:

* In some instances, multiple text options are available to display the same smiley.

疑难解答

为何它不工作?

Smileys may have been disabled by your WordPress admin. Another possibility is the smiley image files have been deleted from /wp-includes/images/smilies.

为何仅在某个站点不工作?

If smileys work for others at your site but not for you:

Type a space before and after your smiley text. That prevents the smiley being accidentally included in the text around it. redface emoticon

Make sure not to use quotes or other punctuation marks before and after the smiley text. rolleyes emoticon

表情图片存放在何处?

The smiley or emoticon image graphics are found in the /wp-includes/images/smilies directory.

Note that smileys is spelled 'eys' in this documentation and the directory name for the smiley images is 'smilies, spelled 'ies'. eek emoticon

如何自选表情图片?

Simplest way:

  1. Find your smiley image files in the /wp-includes/images/smilies directory and back them up to another directory
  2. Note the names of each smiley file. Your files must match these names and should be in the same 'gif' image format.
  3. For predictable behavior, the image sizes should be similar.
  4. Upload your new files to the /wp-includes/images/smilies directory with an FTP program.

If you're up to hacking the code:

If you really must change the file names of the images, edit the file that refers to these images, 'vars.php' (in WordPress 2.2, they're located in 'functions.php'), situated in the /wp-includes/ directory. Follow all precautions when "hacking code".

You can read a tutorial explaining all this in more detail, as well as how to avoid hacking WP code, at Ars Aranea.

There are also WordPress Plugins which allow you to customize your smilies in WordPress.

为什么我的表情图片是空白的?

If you recently uploaded the images, it could be that the images have been uploaded in ASCII format by your FTP program. Re-upload the smileys ensuring that they are transferred in BINARY format.

Some FTP programs have an auto-detect setting which will upload files in the correct format without user intervention. If you have such a setting, turn it on.

表情符号层叠样式表(CSS)样式

The smiley images in WordPress are automatically given a CSS class of wp-smiley when they are displayed in a post. You can use this class to style your smileys differently from other post images.

For example, it's not uncommon to set up images in a post to appear on the left-hand side of the content with text flowing around the image. The CSS for that might look like this:

.post img {
    float: left;
}

This would typically affect all images in a post, including your smiley images. To override this so that smileys stay inline, you could add this to your CSS:

img.wp-smiley {
    float: none;
}

For more on CSS in WordPress, you might want to start here.

关于表情符号的更多信息