将表情符号:-)和:-P转换为显示的图形

时间:2013-04-30 08:42:44

标签: wordpress

我正在从wp_comments表格收到评论,但是当它在浏览器上显示时,它不会显示表情符号而是显示:):D,尽管评论有一些表情符号。我看了Using Smilies,现在我想创建自定义函数,用适当的图标替换:)等等。

但我不知道怎么做?

1 个答案:

答案 0 :(得分:2)

此页面描述了使用表情符号/表情符号作为图形:

http://codex.wordpress.org/Using_Smilies

  • 转到管理面板
  • 选择设置 - >写
  • 选中“将表情符号转换为:-)并将:-P转换为显示图形”
  • 的复选框

如果您正在寻找转换表情符号的wp脚本,请点击此处:

httpdocs/wp-includes/formatting.php

~line:1715

/**
 * Convert one smiley code to the icon graphic file equivalent.
 *
 * Looks up one smiley code in the $wpsmiliestrans global array and returns an
 * <img> string for that smiley.
 *
 * @global array $wpsmiliestrans
 * @since 2.8.0
 *
 * @param string $smiley Smiley code to convert to image.
 * @return string Image string for smiley.
 */
function translate_smiley($smiley) {

...

/**
 * Convert text equivalent of smilies to images.
 *
 * Will only convert smilies if the option 'use_smilies' is true and the global
 * used in the function isn't empty.
 *
 * @since 0.71
 * @uses $wp_smiliessearch
 *
 * @param string $text Content to convert smilies from text.
 * @return string Converted content with text smilies replaced with images.
 */
function convert_smilies($text) {