国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > CMS > Wordpress > 正文

WordPress取消英文標(biāo)點(diǎn)符號自動替換中文標(biāo)點(diǎn)符號的優(yōu)雅方法

2024-09-07 00:49:34
字體:
供稿:網(wǎng)友

眾所周知,WordPress中文版有個(gè)特性,會將每一處英文引號("")都稀里嘩啦轉(zhuǎn)化為中文引號(“”)。不僅僅是英文引號,在WordPress翻譯文件定義了不少自動轉(zhuǎn)換符號,具體可以參考這里。

對文字博客來說,這是個(gè)好功能,這樣會避免用錯(cuò)英文標(biāo)點(diǎn)。

然而,WordPress是獨(dú)立的php程序,中文社區(qū)中懂得使用者,大部分都是技術(shù)博客。而技術(shù)博客會經(jīng)常貼出代碼,里面包含各種英文標(biāo)點(diǎn)是再正常不過的事情。這時(shí)候,英文標(biāo)點(diǎn)符號自動轉(zhuǎn)換就是一個(gè)惱人的畫蛇添足功能了。

網(wǎng)上很多文章都是讓該WordPress核心文件。只不過,WordPress是一個(gè)高度模塊化的系統(tǒng),肯定有更優(yōu)雅的解決方案。

一番搜尋之后,發(fā)現(xiàn)最簡單的辦法,就是安裝一個(gè)叫Quotmarks Replacer的插件,地址在這里。

插件很簡單,就是將WordPress自動轉(zhuǎn)換標(biāo)點(diǎn)符號的函數(shù)用系統(tǒng)接口去掉。核心代碼如下:

 

<?php/*Plugin Name: Quotmarks ReplacerPlugin URI: http://sparanoid.com/work/quotmarks-replacer/Description: Quotmarks Replacer disables wptexturize function that keeps all quotation marks and suspension points in half-width form.Version: 2.6.17Author: Tunghsiao LiuAuthor URI: http://sparanoid.com/Author Email: t@sparanoid.comLicense: GPLv2 or laterCopyright 2016 Tunghsiao Liu, aka. Sparanoid (t@sparanoid.com)This program is free software; you can redistribute it and/or modifyit under the terms of the GNU General Public License, version 2, aspublished by the Free Software Foundation.This program is distributed in the hope that it will be useful,but WITHOUT ANY WARRANTY; without even the implied warranty ofMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See theGNU General Public License for more details.You should have received a copy of the GNU General Public Licensealong with this program; if not, write to the Free SoftwareFoundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA*/$qmr_work_tags = array('the_title',             // http://codex.wordpress.org/Function_Reference/the_title'the_content',           // http://codex.wordpress.org/Function_Reference/the_content'the_excerpt',           // http://codex.wordpress.org/Function_Reference/the_excerpt// 'list_cats',          Deprecated. http://codex.wordpress.org/Function_Reference/list_cats'single_post_title',     // http://codex.wordpress.org/Function_Reference/single_post_title'comment_author',        // http://codex.wordpress.org/Function_Reference/comment_author'comment_text',          // http://codex.wordpress.org/Function_Reference/comment_text// 'link_name',          Deprecated.// 'link_notes',         Deprecated.'link_description',      // Deprecated, but still widely used.'bloginfo',              // http://codex.wordpress.org/Function_Reference/bloginfo'wp_title',              // http://codex.wordpress.org/Function_Reference/wp_title'term_description',      // http://codex.wordpress.org/Function_Reference/term_description'category_description',  // http://codex.wordpress.org/Function_Reference/category_description'widget_title',          // Used by all widgets in themes'widget_text'            // Used by all widgets in themes);foreach ( $qmr_work_tags as $qmr_work_tag ) {remove_filter ($qmr_work_tag, 'wptexturize');}

當(dāng)然你也可以參考這篇文章:http://www.survivalescaperooms.com/cms/261975.html

發(fā)表評論 共有條評論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 新邵县| 理塘县| 朝阳县| 滨州市| 普兰店市| 黄梅县| 福清市| 蓬溪县| 宜春市| 富川| 茂名市| 海口市| 呼伦贝尔市| 金堂县| 会昌县| 兴城市| 舞钢市| 綦江县| 即墨市| 康乐县| 礼泉县| 汝州市| 西乡县| 二连浩特市| 都安| 吉木萨尔县| 简阳市| 石河子市| 唐山市| 剑川县| 二手房| 和龙市| 林甸县| 肃宁县| 卓资县| 沁水县| 南投市| 临城县| 杭州市| 彰化市| 天峻县|