最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

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

  發(fā)布時間:2017-04-04 18:55:43   作者:佚名   我要評論
這篇文章主要介紹了WordPress取消英文標點符號自動替換中文標點符號的優(yōu)雅方法,需要的朋友可以參考下

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

對文字博客來說,這是個好功能,這樣會避免用錯英文標點。

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

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

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

插件很簡單,就是將WordPress自動轉(zhuǎn)換標點符號的函數(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');
}

當然你也可以參考這篇文章:http://www.fzitv.net/cms/261975.html

相關文章

最新評論

察雅县| 榆中县| 额济纳旗| 长春市| 邯郸县| 鸡东县| 扶绥县| 黔江区| 文山县| 三江| 宝坻区| 寿阳县| 白城市| 晋城| 武乡县| 周至县| 漳州市| 郴州市| 北票市| 文化| 阜新| 城市| 习水县| 宜城市| 溆浦县| 西乌| 洛南县| 永清县| 双牌县| 基隆市| 揭西县| 安远县| 高清| 平顶山市| 九龙城区| 双牌县| 米脂县| 厦门市| 甘肃省| 乌拉特中旗| 葫芦岛市|