由于我的最后一个(第一个)插件变得有点难以管理与6个管理页在一个文件,我决定将他们分开为这一个,但我得到的只是问题这样做。
在我的插件函数文件(LoadPressFunctions.php)中,我有以下内容:
add_action( 'admin_menu', 'my_plugin_menu' );
function my_plugin_menu() {
add_menu_page( 'LoadPress', 'LoadPress', 'manage_options', 'LoadPressPlugin', 'LoadPress_Plugin', 'dashicons-download', 99 );
}
function LoadPress_Plugin() {
if ( !current_user_can( 'manage_options' ) ) {
wp_die( __( 'You do not have sufficient permissions to access this page.' ) );
}
include 'LoadPressOptions-Home.php';
}在我的LoadPressOptions- have . And文件中,我有以下内容:
<?php
echo '<style>
h1 {
letter-spacing: 8px;
}
.sectionHeader {
background-color: #E5E5E5;
padding: 1px 10px 1px 10px;
margin: 10px 0px 0px 0px;
border-left: 4px solid #2A333E;
}
.sectionNotification {
background-color: #E5E5E5;
padding: 1px 10px 1px 10px;
margin: 5px 0px 0px 0px;
border-left: 4px solid #ffce1f;
}
ul#adminmenu a.wp-has-current-submenu:after, ul#adminmenu>li.current>a.current:after {
border-right-color: #12171C;
}
</style>';
echo '<div class="wrap">';
echo '<h1>LoadPress</h1>';
echo '<p class="description" id="tagline-description">Simplify Brilliance, Simplify Life.</p>';
?>
<h2 class="nav-tab-wrapper">
<a class="nav-tab nav-tab-active" href="<?php echo admin_url() ?>admin.php?page=LoadPressPlugin">Home</a>
<!--<a class="nav-tab" href="<?php echo admin_url() ?>admin.php?page=LoadPressPlugin-Settings">Settings</a>-->
<a class="nav-tab" href="<?php echo admin_url() ?>admin.php?page=LoadPressPlugin-About">About/Credits</a>
<a class="nav-tab" style="background-color: red;">Settings (Not available in Alpha)</a>
<a class="nav-tab" href="<?php echo admin_url() ?>admin.php?page=LoadPressPlugin-Docs">Documentation</a>
<a class="nav-tab" style="background-color: red;">Email Editor (Coming Soon)</a>
</h2>
<?php
//Options
echo '<div>';
?>
<img src="<?php echo get_site_url() ?>/wp-content/plugins/LoadPress/LoadPressLogo-Banner.png" style="margin-top: 10px;"/>
<?php
echo '</div>';
?>
<div class="sectionNotification">
<h3>Thank You for choosing LoadPress</h3>
</div>
<div class="sectionHeader">
<h3>What is LoadPress?</h3>
<p>LoadPress is a professional plugin that allows site community members to post downloadable files, such as modifications, save files and other community applicable files.</p>
<p>This plugin was developed for use primarily with modding communities for video games, and other video game related products, and uses a simplistic yet robust setup with several different fallbacks in case of mistakes.</p>
<p>At the time of writing this, LoadPress is primarily used for in-house projects developed by Kyle Briggs & Don Briggs Ltd.</p>
</div>
<div class="sectionHeader">
<h3>Why LoadPress?</h3>
<p>LoadPress is an excellent choice for targeted community functionality as it offers several things other plugins do not:</p>
<ol>
<li>It allows users to upload files in any format (settable by editing the plugin).</li>
<li>It allows total administrative control over all files, but only gives regular users access to their own.</li>
<li>It simplifies the Media section to only display a regular user's own media (admins can see all).</li>
<li>It is the ONLY plugin currently available for Wordpress that offers this functionality tailored specifically to file-sharing, and works seamlessly with any SEO package.</li>
<li>At the core, it runs on Wordpress' own API so the custom post type can be edited to your needs easily.</li>
</ol>
</div>
</div>
<?php但是现在我得到了一个空白页,因为我已经将这个内容从主文件移到了它自己的文件中,没有从它加载任何内容。
如果我将文件内容替换为:
<?php
echo '<h1>Hi</h1>';一切正常,但我看不到Home.php内容的语法错误,因为它是直接从函数中复制和粘贴的(并添加了)。
有什么想法吗?
发布于 2016-06-20 13:39:38
在wordpress中启用调试了吗?
在根wordpress文件夹中打开wp-config.php并更改以下行:
define('WP_DEBUG', false);至
define('WP_DEBUG', true);然后,PHP错误将输出到屏幕上。
https://wordpress.stackexchange.com/questions/230252
复制相似问题