手机收到了WP4.2版的更新通知,习惯性的点了一下,迅速升完看了下更新内容,一些常规性的也便罢了,但有一条引起了兴趣:
扩展的字符集支持
无论您使用何种语言,在WordPress中写作都将变得更好。WordPress 4.2将原生支持许多新字符,包括中日韩文字、音乐和数学符号,以及象形文字。
即使您没有在使用以上那些字符,您仍可获益——WordPress现已支持颜文字!发挥创意并用 💙, 🐸, 🐒, 🍕, 与所有其他颜文字来装点您的内容。
看来emoji随着ios8的发布快要一统天下了啊!不过官方也明确说emoji和smiley在WP上是不同的:
Emoji are not Smileys
Not quite. Emoji are a newer development than smileys (a.k.a. emoticons). They are created differently, and handled differently by operating systems and web browsers. For more information about smileys, please see the Using Smileys page.
话说以后还有必要花很多精力玩smiley这种东西吗。
来试试看emoji的效果。在我的S5手机输入几个看看(目前仅支持iOS、Android、Windows 8.1以上版本、MacOS等系统,以及如Safari、IE11、Chrome等部分浏览器):
😜😄👍💰
最后:发现该功能引用了站外资源,严重拖累了速度,且跟以前装的twitter emoji和系统自带的smiley冲突。为保险起见,暂时屏蔽部分功能。方法引用了《WordPress 4.2禁用Emoji表情》:
/**
* Disable the emoji's
*/
function disable_emojis() {
remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
remove_action( 'wp_print_styles', 'print_emoji_styles' );
remove_action( 'admin_print_styles', 'print_emoji_styles' );
remove_filter( 'the_content_feed', 'wp_staticize_emoji' );
remove_filter( 'comment_text_rss', 'wp_staticize_emoji' );
remove_filter( 'wp_mail', 'wp_staticize_emoji_for_email' );
add_filter( 'tiny_mce_plugins', 'disable_emojis_tinymce' );
}
add_action( 'init', 'disable_emojis' );
/**
* Filter function used to remove the tinymce emoji plugin.
*
* @param array $plugins
* @return array Difference betwen the two arrays
*/
function disable_emojis_tinymce( $plugins ) {
return array_diff( $plugins, array( 'wpemoji' ) );
}
如果想保留原来的smiley,用这段代码:
function smilies_reset() {
global $wpsmiliestrans, $wp_smiliessearch;
// don't bother setting up smilies if they are disabled
if ( !get_option( 'use_smilies' ) )
return;
$wpsmiliestrans = array(
':mrgreen:' => 'icon_mrgreen.gif',
':neutral:' => 'icon_neutral.gif',
':twisted:' => 'icon_twisted.gif',
':arrow:' => 'icon_arrow.gif',
':shock:' => 'icon_eek.gif',
':smile:' => 'icon_smile.gif',
':???:' => 'icon_confused.gif',
':cool:' => 'icon_cool.gif',
':evil:' => 'icon_evil.gif',
':grin:' => 'icon_biggrin.gif',
':idea:' => 'icon_idea.gif',
':oops:' => 'icon_redface.gif',
':razz:' => 'icon_razz.gif',
':roll:' => 'icon_rolleyes.gif',
':wink:' => 'icon_wink.gif',
':cry:' => 'icon_cry.gif',
':eek:' => 'icon_surprised.gif',
':lol:' => 'icon_lol.gif',
':mad:' => 'icon_mad.gif',
':sad:' => 'icon_sad.gif',
'8-)' => 'icon_cool.gif',
'8-O' => 'icon_eek.gif',
':-(' => 'icon_sad.gif',
':-)' => 'icon_smile.gif',
':-?' => 'icon_confused.gif',
':-D' => 'icon_biggrin.gif',
':-P' => 'icon_razz.gif',
':-o' => 'icon_surprised.gif',
':-x' => 'icon_mad.gif',
':-|' => 'icon_neutral.gif',
';-)' => 'icon_wink.gif',
// This one transformation breaks regular text with frequency.
// '8)' => 'icon_cool.gif',
'8O' => 'icon_eek.gif',
':(' => 'icon_sad.gif',
':)' => 'icon_smile.gif',
':?' => 'icon_confused.gif',
':D' => 'icon_biggrin.gif',
':P' => 'icon_razz.gif',
':o' => 'icon_surprised.gif',
':x' => 'icon_mad.gif',
':|' => 'icon_neutral.gif',
';)' => 'icon_wink.gif',
':!:' => 'icon_exclaim.gif',
':?:' => 'icon_question.gif',
);
}
smilies_reset();
本周某事不顺,工作尚可,仍需努力。明天部门组织宜兴休闲游。放松下心情吧……嗯。
我喜欢用emoji哈哈哈哈好开心☺️
@Never用了后很卡啊有木有 😯
你无锡的?
@从良未遂是的 😎
还没有更新..... 😉
@顾夕舞要更新啥呀 😎
WP已成功更新到最新版。
@夏日博客好。