简体   繁体   English

使用自定义插件覆盖wordpress主题语言文件

[英]Override a wordpress theme language file using a custom plugin

I am using a wordpress theme that contains several language files. 我正在使用一个包含多个语言文件的wordpress主题。 I would like to modify a language file to "white label" the theme I am using. 我想将语言文件修改为“白标”我正在使用的主题。 I will also be making other admin-css changes to the theme, therefore, I'd like to create a plugin that allows me to do all of this. 我还将对该主题进行其他admin-css更改,因此,我想创建一个插件,使我能够执行所有这些操作。

What I am unsure of how to do is create a custom plugin that would override a themes language file - is this possible? 我不确定该怎么做,就是创建一个将覆盖主题语言文件的自定义插件-这可能吗?

I have so far tried this: 到目前为止,我已经尝试过:

<?php 
/*
Plugin Name: Layers Whitelabel test
Plugin URI: http://www.skizzar.com
Description: Plugin to whitelabel layers for Skizzar
Author: Skizzar
Version: 1.0
Author URI: http://www.skizzar.com
*/ 

function set_myplugins_languages() {
    load_textdomain( 'layerswp', plugin_dir_url( __FILE__ ) . '/language' );
}
add_action('init', 'set_myplugins_languages');

But so far no joy - as in, it doesn't load the new language file in place of the existing one. 但是到目前为止,还没有喜悦-例如,它不会加载新的语言文件来代替现有的语言文件。

Anyone got any ideas on how this can be achieved? 任何人都对如何实现这一目标有任何想法?

Well, why do you need a plugin for this? 好吧,为什么您需要一个插件呢?

The theme style.css have similar code to 主题style.css与

Plugin Name: Layers Whitelabel test
Plugin URI: http://www.skizzar.com
Description: Plugin to whitelabel layers for Skizzar
Author: Skizzar
Version: 1.0
Author URI: http://www.skizzar.com

So you can simply change theme display name, url, author etc. 因此,您只需更改主题显示名称,URL,作者等。

Basically it's easy to do, however it's against theme copyrighting ;) Even if this is a GPL theme you should refer to original developer. 基本上,这很容易做到,但是与主题版权背道而驰;)即使这是GPL主题,您也应该参考原始开发人员。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM