用CSS Sprites合并WordPress表情图片教程
1、修改 网站根目录/wp-includes/functions.php中smilies_init() …
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样式。(代码略)
本文收集自互联网,转载请注明来源。
如有侵权,请联系 wper_net@163.com 删除。
还没有任何评论,赶紧来占个楼吧!