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

眾所周知,WordPress中文版有個(gè)特性,會(huì)將每一處英文引號(hào)("")都稀里嘩啦轉(zhuǎn)化為中文引號(hào)(“”)。不僅僅是英文引號(hào),在WordPress翻譯文件定義了不少自動(dòng)轉(zhuǎn)換符號(hào),具體可以參考這里。
對(duì)文字博客來(lái)說(shuō),這是個(gè)好功能,這樣會(huì)避免用錯(cuò)英文標(biāo)點(diǎn)。
然而,WordPress是獨(dú)立的php程序,中文社區(qū)中懂得使用者,大部分都是技術(shù)博客。而技術(shù)博客會(huì)經(jīng)常貼出代碼,里面包含各種英文標(biāo)點(diǎn)是再正常不過(guò)的事情。這時(shí)候,英文標(biāo)點(diǎn)符號(hào)自動(dòng)轉(zhuǎn)換就是一個(gè)惱人的畫(huà)蛇添足功能了。
網(wǎng)上很多文章都是讓該WordPress核心文件。只不過(guò),WordPress是一個(gè)高度模塊化的系統(tǒng),肯定有更優(yōu)雅的解決方案。
一番搜尋之后,發(fā)現(xiàn)最簡(jiǎn)單的辦法,就是安裝一個(gè)叫Quotmarks Replacer的插件,地址在這里。
插件很簡(jiǎn)單,就是將WordPress自動(dòng)轉(zhuǎn)換標(biāo)點(diǎn)符號(hào)的函數(shù)用系統(tǒng)接口去掉。核心代碼如下:
<?php /* Plugin Name: Quotmarks Replacer Plugin 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.17 Author: Tunghsiao Liu Author URI: http://sparanoid.com/ Author Email: t@sparanoid.com License: GPLv2 or later Copyright 2016 Tunghsiao Liu, aka. Sparanoid (t@sparanoid.com) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2, as published 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 of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, 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.dbjr.com.cn/cms/261975.html
相關(guān)文章
CyberPanel安裝WordPress并配置偽靜態(tài)規(guī)則
下面教你如何在 CyberPanel安裝WordPress以及配置偽靜態(tài),需要的朋友可以參考下2023-12-27- 這篇文章主要介紹了wordpress無(wú)法安裝更新主題插件的解決辦法,需要的朋友可以參考下2020-12-27
WordPress必備數(shù)據(jù)庫(kù)SQL查詢語(yǔ)句整理
發(fā)現(xiàn)幾條比較實(shí)用的,適合 WordPress 實(shí)用的SQL語(yǔ)句。于是就趕緊收集分享出來(lái)了,需要的朋友可以參考下2017-09-23wordpress在安裝使用中出現(xiàn)404、403、500及502問(wèn)題的分析與解決方法
wordpress是很多新手站長(zhǎng)搭建個(gè)人博客最喜愛(ài)的程序,但是最近在使用WordPress的時(shí)候遇到了一些問(wèn)題,所以想著將遇到問(wèn)題總結(jié)分享出來(lái),下面這篇文章主要給大家介紹了關(guān)于wo2017-08-11WordPress取消英文標(biāo)點(diǎn)符號(hào)自動(dòng)替換中文標(biāo)點(diǎn)符號(hào)的優(yōu)雅方法
這篇文章主要介紹了WordPress取消英文標(biāo)點(diǎn)符號(hào)自動(dòng)替換中文標(biāo)點(diǎn)符號(hào)的優(yōu)雅方法,需要的朋友可以參考下2017-04-04- 這篇文章主要給大家介紹了wordpress自定義上傳文件類型的方法,如WordPress默認(rèn)允許上傳 .exe 后綴名的可運(yùn)行文件,那么我們?cè)趺唇褂脩粼赪ordPress后臺(tái)發(fā)表文章時(shí)上傳 .e2016-12-19
- 大家可能發(fā)現(xiàn)了當(dāng)實(shí)現(xiàn)了前端用戶中心,后臺(tái)控制面板就失去了作用,那么限制其他用戶進(jìn)入后臺(tái)控制面板就很有必要了!那么我們要怎么做呢?通過(guò)下面這篇文章分享的方法后,只2016-12-19
WordPress實(shí)現(xiàn)回復(fù)文章評(píng)論后發(fā)送郵件通知的功能
這篇文章主要介紹了WordPress實(shí)現(xiàn)回復(fù)文章評(píng)論后發(fā)送郵件通知的功能,涉及wordpress針對(duì)評(píng)論與郵件的相關(guān)操作技巧,需要的朋友可以參考下2016-10-11WordPress使用自定義文章類型實(shí)現(xiàn)任意模板的方法
這篇文章主要介紹了WordPress使用自定義文章類型實(shí)現(xiàn)任意模板的方法,可通過(guò)自定義文章類型來(lái)實(shí)現(xiàn)任意模版的使用,具有一定參考借鑒價(jià)值,需要的朋友可以參考下2016-10-11WordPress后臺(tái)地址被改導(dǎo)致無(wú)法登陸后臺(tái)的簡(jiǎn)單解決方法
這篇文章主要介紹了WordPress后臺(tái)地址被改導(dǎo)致無(wú)法登陸后臺(tái)的簡(jiǎn)單解決方法,簡(jiǎn)單分析了后臺(tái)無(wú)法登陸的原因與相應(yīng)的解決方法,涉及針對(duì)wordpress配置項(xiàng)的簡(jiǎn)單修改,需要的朋友2016-10-11