我正在开发我的第一个插件,当我尝试访问wp admin时,wordpress显示以下错误:致命错误:未捕获错误:调用中未定义的函数settings\\u fields()/插件/wtdomcheck/admin/html/settings。菲律宾比索:25
插件文件wtdomcheck。php
..
..
define( \'WTDOMCHECK_PLUGIN_DIR\', plugin_dir_path( __FILE__ ) );
..
..
if ( is_admin() ) {
require_once( \'admin/wtdomcheck_admin.php\' );
} else {
require_once( \'public/wtdomcheck_front.php\' );
}
..
..
插件文件wtdomcheck\\u admin。php
..
..
require_once WTDOMCHECK_PLUGIN_DIR.\'admin/class/class-admin.php\';
if ( class_exists(admin) ) {
$wtdomadmin = new admin();
$wtdomadmin->register();
}
..
..
插件文件类管理。php
..
..
require_once \'api.php\';
class admin
{
public $pluginName;
public $settings;
public $pages = array();
public $subpages = array();
function __construct()
{
$this->pluginName = plugin_basename( __FILE__ );
$this->settings = new ApiWpadmin();
$this->pages = [
[
\'page_title\' => \'WT Domain Check\',
\'menu_title\' => \'WTDomCheck\',
\'capability\' => \'manage_options\',
\'menu_slug\' => \'wtdomaincheck\',
\'callback\' => $this->LoadSettingTemplate(),
\'icon_url\' => \'dashicons-store\',
\'position\' => 117
]
];
$this->subpages = [
/*[
\'parent_slug\'=> \'wtdomaincheck\',
\'page_title\' => \'Settings\',
\'menu_title\' => \'Settings\',
\'capability\' => \'manage_options\',
\'menu_slug\' => \'settings\',
\'callback\' => function() { echo \'<h1>Taxonomies Manager</h1>\'; },
]*/
];
add_action( \'add_meta_boxes\', array( $this, \'LoadMetabox\') );
add_action(\'edit_form_after_title\', array( $this, \'DelAllMetaboxes\') );
}
//
// PARAM
// Register all the actions and filters for the Admin area
//
public function register()
{
//Call the concatenated API method to contruct the menu, and submenu
$this->settings->AddPages( $this->pages )->WithSubPage( \'Settings\' )->AddSubPages( $this->subpages )->register();
add_action(\'admin_init\', array($this, \'SaveSettings\') );
add_filter( \'plugin_action_links_\'.WTDOMCHECK_PLUGIN_NAME, array($this->settings, \'AddCustomLinks\') );
add_action("manage_posts_custom_column", array( $this, \'EditColumns\') );
add_filter("manage_edit-wt_whoisservers_columns", array( $this, \'FilterColumns\') );
}
//
// PARAM
// Loads the template that shows the settings page
//
public function LoadSettingTemplate()
{
include_once WTDOMCHECK_PLUGIN_DIR.\'admin/html/settings.php\';
}
插件文件设置。php
<?php
//require_once \'/www/lr-webstower.com.ar/htdocs/wp-load.php\';
//array($field_type, $echo_string, $id, $rows)
$fields = array(
array(\'checkbox\',\'Field 1\',\'fieldname1\',\'1\'),
array(\'checkbox\',\'Field 2\',\'fieldname2\',\'1\'),
array(\'textarea\',\'Field 3\',\'fieldname3\',\'3\'),
array(\'textarea\',\'Field 4\',\'fieldname4\',\'3\'),
array(\'textarea\',\'Field 5\',\'fieldname5\',\'3\'),
array(\'text\',\'Field 6\',\'fieldname6\',\'1\'),
array(\'text\',\'Field 7\',\'fieldname7\',\'1\'),
array(\'text\',\'Field 8\',\'fieldname8\',\'1\'),
array(\'text\',\'Field 9\',\'fieldname9\',\'1\'),
array(\'text\',\'Field 10\',\'fieldname10\',\'1\'),
array(\'echo\',\'Message 1\',\'\',\'1\')
);
?>
<div class="wrap">
<h2><?php _e(\'WTDomCheck Setup\', \'wtdomcheck\') ?></h2>
<form method="post" action="options.php">
<?php settings_fields( \'wtdomcheck-settings\' ); ?>
<div id="poststuff">
<div class="postbox">
<h3> <?php _e(\'Result Settings\', \'wtdomcheck\') ?></h3>
<div class="inside">
<table class="form-table">