• linkedu视频
  • 平面设计
  • 电脑入门
  • 操作系统
  • 办公应用
  • 电脑硬件
  • 动画设计
  • 3D设计
  • 网页设计
  • CAD设计
  • 影音处理
  • 数据库
  • 程序设计
  • 认证考试
  • 信息管理
  • 信息安全
菜单
linkedu.com
  • 网页制作
  • 数据库
  • 程序设计
  • 操作系统
  • CMS教程
  • 游戏攻略
  • 脚本语言
  • 平面设计
  • 软件教程
  • 网络安全
  • 电脑知识
  • 服务器
  • 视频教程
  • dedecms
  • ecshop
  • z-blog
  • UcHome
  • UCenter
  • drupal
  • WordPress
  • 帝国cms
  • phpcms
  • 动易cms
  • phpwind
  • discuz
  • 科汛cms
  • 风讯cms
  • 建站教程
  • 运营技巧
您的位置:首页 > CMS教程 >WordPress > WordPress取消英文标点符号自动替换中文标点符号的优雅方法

WordPress取消英文标点符号自动替换中文标点符号的优雅方法

作者:佚名 字体:[增加 减小] 来源:互联网 时间:2017-05-13

佚名 向大家介绍了wordpress英文版,wordpress英文版下载,wordpress英文主题,wordpress英文,wordpress 中英文等相关知识,希望对您有所帮助

众所周知,WordPress中文版有个特性,会将每一处英文引号("")都稀里哗啦转化为中文引号(“”)。不仅仅是英文引号,在WordPress翻译文件定义了不少自动转换符号,具体可以参考这里。

对文字博客来说,这是个好功能,这样会避免用错英文标点。

然而,WordPress是独立的php程序,中文社区中懂得使用者,大部分都是技术博客。而技术博客会经常贴出代码,里面包含各种英文标点是再正常不过的事情。这时候,英文标点符号自动转换就是一个恼人的画蛇添足功能了。

网上很多文章都是让该WordPress核心文件。只不过,WordPress是一个高度模块化的系统,肯定有更优雅的解决方案。

一番搜寻之后,发现最简单的办法,就是安装一个叫Quotmarks Replacer的插件,地址在这里。

插件很简单,就是将WordPress自动转换标点符号的函数用系统接口去掉。核心代码如下:

 

<?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');
}
</div>

当然你也可以参考这篇文章:http://www.weikejianghu.com/cms/261975.html

</div>
分享到:QQ空间新浪微博腾讯微博微信百度贴吧QQ好友复制网址打印

您可能想查找下面的文章:

  • WordPress取消英文标点符号自动替换中文标点符号的优雅方法

相关文章

  • 2017-05-13修改WordPress链接顺序和排序的方法
  • 2018-11-02全方位统计wordpress网站:WP Statistics插件
  • 2018-11-02小兽仿雷锋网WordPress主题说明文档
  • 2017-05-13wordpress模板常用函数集锦
  • 2018-11-02无插件为wordpress主题添加面包屑导航
  • 2018-11-02WordPress主题隐藏后台页面中指定页面
  • 2017-05-13WordPress自定义多个边栏的方法
  • 2017-05-13较完美的WordPress文章摘要(截断)方案分享
  • 2018-11-02wordpress搜索引擎优化SEO
  • 2017-05-13WordPress 评论者超链接实现重定向跳转的方法

文章分类

  • dedecms
  • ecshop
  • z-blog
  • UcHome
  • UCenter
  • drupal
  • WordPress
  • 帝国cms
  • phpcms
  • 动易cms
  • phpwind
  • discuz
  • 科汛cms
  • 风讯cms
  • 建站教程
  • 运营技巧

最近更新的内容

    • WordPress 标签Tags页面制作方法
    • wordpress 文章分页 实用的wordpress长文章分页代码
    • 改进WordPress主题加载速度的技巧
    • 能有效改善WordPress CMS功能的8个插件分享
    • WordPress屏蔽评论中链接地址的方法
    • WordPress文章找不到|我的WordPress文档怎么打不开?|not found解决方案
    • Wordpress分类,标签,分页显示及翻页出现404错误的解决方法
    • 加速WordPress技巧:Redis缓存输出的HTML页面
    • 有几十个企业官网要部署,wordpress模式选择
    • WordPress可视化表格插件:WP Tabel Tag Gen

关于我们 - 联系我们 - 免责声明 - 网站地图

©2020-2025 All Rights Reserved. linkedu.com 版权所有