1、修改 网站根目录/wp-includes/functions.php中smilies_init() 的定义。下面是我修改后的smilies_init()中if ( !isset( $wpsmiliestrans ) )部分。
‘:(1):’ => ‘xiaone_1′,
‘:(2):’ => ‘xiaonei_2′,
‘:(3):’ => ‘xiaonei_3′,
‘:(4):’ => ‘xiaonei_4′,
‘:(5):’ => ‘xiaonei_5′,
‘:(6):’ => ‘xiaonei_6′,
‘:(7):’ => ‘xiaonei_7′,
‘:(8):’ => ‘xiaonei_8′,
‘:(9):’ => ‘xiaonei_9′,
‘:(10):’ => ‘xiaonei_10′,
‘:(11):’ => ‘xiaonei_11′,
‘:(12):’ => ‘xiaonei_12′,
‘:(13):’ => ‘xiaonei_13′,
‘:(14):’ => ‘xiaonei_14′,
‘:(15):’ => ‘xiaonei_15′,
‘:(16):’ => ‘xiaonei_16′,
‘:(17):’ => ‘xiaonei_17′,
‘:(18):’ => ‘xiaonei_18′,
‘:(19):’ => ‘xiaonei_19′,
‘:(20):’ => ‘xiaonei_20′,
‘:(21):’ => ‘xiaonei_21′,
‘:(22):’ => ‘xiaonei_22′,
‘:(23):’ => ‘xiaonei_23′,
‘:(24):’ => ‘xiaonei_24′,
);
}
2、修改 网站根目录/wp-includes/formatting.php 中 function translate_smiley($smiley) 的定义。下面是我修改后的function translate_smiley($smiley) 的代码段。
function translate_smiley($smiley) {
global $wpsmiliestrans;
if (count($smiley) == 0) {
return ”;
}
$siteurl = get_option( ’siteurl’ );
$smiley = trim(reset($smiley));
$img = $wpsmiliestrans[$smiley];
$smiley_masked = esc_attr($smiley);
return ” <a class=’wp-smiley $img’ ></a> “;
}
3、在评论文本框附近的表情显示(就是你能看到的点击一个表情就会在文本框输入对应的符号),由于我没有用WP表情插件,用的是老万他们用的smiley.php这个文件,所以接下来做的就是修改smiley.php了(由于这里贴代码没有太大意义,所以在文章最后所有修改后的文件一并给出)
4、设计CSS样式。(代码略)
主题猫WP建站,累计帮助1300+客户成功建站,为站长提供支持!
立刻开启你的建站之旅