此插件有两个问题,请帮助。。。
1我的插件正在破坏我的/wp管理,我得到的只是一个白色屏幕,而不是转发到登录屏幕,登录屏幕在启用时也会被破坏。其余现场工程。
2我的插件的另一个问题是,我无法让它回显该目录中的文件。这些样式中有两个文件。css和new。css。我以前使用过这种方法来显示文件夹中的文件,但我无法在这里使用它。
<?php
/*
Plugin Name: Call Custom CSS
Description: Call custom CSS files to your theme while still being to recieve theme development updates
Version: 1.1.0
Author: Michele Narup
Author URI: http://michelenarup.com
*/
function addcss(){
$directory = get_site_url() . "/wp-content/css/";
$stylesheets = glob($directory . "*.css");
wp_enqueue_style(\'styles\' , get_site_url(). \'/wp-content/css/style.css\');
//echo $directory;
foreach($stylesheets as $stylesheet)
{
echo "<link rel=\'stylesheet\'";
echo $stylesheet;
echo "type=\'text/css\' media=\'all\' />";
}
}
add_action(\'wp_head\', \'addcss\');
?>
根据下面评论中的讨论,我将函数改为现在:
/*
Plugin Name: Call Custom CSS
Description: Call custom CSS files to your theme while still being to receive theme development updates
Version: 1.1.0
Author: Michele Narup
Author URI: http://michelenarup.com
*/
function load_my_style () {
wp_register_style(\'customstyle\', get_site_url() . \'/wp-content/css/style.css\');
wp_enqueue_style(\'customstyle\');
}
add_action(\'wp_enqueue_scripts\', \'load_my_style\');
这可以工作,但不能解决白屏问题/wp admin仍然没有在页面或页面源上呈现任何内容。另请注意,根据新函数,问题#2现在无关紧要,稍后我将重新讨论。目前,我的重点是让登录屏幕正常工作。