简体   繁体   English

调用WordPress插件的PHP函数

[英]Call PHP function of a WordPress plugin

So I installed this plugin https://wordpress.org/plugins/wp-db-table-editor/ 所以我安装了这个插件https://wordpress.org/plugins/wp-db-table-editor/

In "how to install", it says I have to call the add_db_table_editor function in my theme's functions.php in order for the plugin interface to show 在“如何安装”中,它表示我必须在主题的functions.php中调用add_db_table_editor函数,以便显示插件界面

Installing screenshot 安装屏幕截图 在此处输入图片说明

I added this code at the very bottom of functions.php file, and when I refresh my website, it won't load. 我将此代码添加到functions.php文件的最底部,当我刷新网站时,它将不会加载。

This is my code (i'm very new to coding): 这是我的代码(我对编码非常陌生):

function add_db_table_editor(){

if(function_exists(‘add_db_table_editor’)){ add_db_table_editor(‘title=Employees&table=employees’);

add_db_table_editor(array( ‘title’=>’Test title’, ‘table’=>’wp_posts’, ‘sql’=>’SELECT));

     }
}

In wordpress you have to go to 在WordPress中,你必须去

{wpinstallfolder}/wp-content/themes/{active_theme}

inside that active_theme folder you should find the 在该active_theme文件夹中,您应该找到

functions.php

Before you add any code to the functions.php you need to back it up, to revert back to in case you do not edit it properly. 在将任何代码添加到functions.php之前,您需要对其进行备份,以恢复到未正确编辑的状态。

Open it up and add the lines that the plugin told you to add. 打开它并添加插件告诉您添加的行。 and save it. 并保存。

This is a formated code block to help you 这是一个格式化的代码块,可以帮助您

function add_db_table_editor(){
    if(function_exists('add_db_table_editor')){ 
        add_db_table_editor('title=Employees&table=employees');
        add_db_table_editor(array( 'title'=>'Test title', 'table'=>'wp_posts', 'sql'=>'SELECT * FROM event_registrations ORDER BY date_entered DESC'));
    }
}

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

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