来自wordpress主题的functions.php文件出错

时间:2017-11-13 00:22:36

标签: php wordpress wordpress-theming

我对PHP一无所知,所以我无法弄清楚错误是否在代码中或是否是更新问题。 当我在我的新Wordpress上激活主题时,我收到以下错误消息:

enter image description here

在functions.php文件中,与错误相关的代码行是(我相信)以下内容:

    if (!class_exists('mijnpress_plugin_framework')) {
    include('find_replace/mijnpress_plugin_framework.php');

}
class plugin_findreplace extends mijnpress_plugin_framework {
    function __construct() {
        $this->showcredits               = true;
        $this->showcredits_fordevelopers = true;
        $this->plugin_title              = 'Find and replace';
        $this->plugin_class              = 'plugin_findreplace';
        $this->plugin_filename           = 'find-replace/plugins/find_replace.php';
        $this->plugin_config_url         = 'plugins.php?page=' . $this->plugin_filename;
    }
    function plugin_findreplace() {
        $args = func_get_args();
        call_user_func_array(array(
            &$this,
            '__construct'
        ), $args);
    }
    function addPluginSubMenu() {
        $plugin = new plugin_findreplace();

        add_submenu_page('optionsframework', 'documentation', 'Documentation', 'manage_options', 'documentation', 'documentations_callback');
        add_submenu_page('optionsframework', 'Find & Replace', 'Find & Replace', 'manage_options', 'fine_and_replace', 'findreplace_callback');
    }
    /**
     * Additional links on the plugin page
     */
    function addPluginContent($links, $file) {
        $plugin = new plugin_findreplace();
        $links  = parent::addPluginContent($plugin->plugin_filename, $links, $file, $plugin->plugin_config_url);
        return $links;
    }

错误可能来自哪个想法?

1 个答案:

答案 0 :(得分:2)

我认为问题可能是函数add_plugin_content()要求使用4个参数声明它以与框架兼容。你只用2个参数声明它,但应该像我在下面写的那样声明它。

function addPluginContent($filename, $links, $file, $config_url) {
        // insert your code here
}