Wordpress可以';在正确的目录中找不到php文件


Wordpress can't find php file in correct directory

我正在学习wordpress,我一直在学习一些非常好的教程并阅读代码,但我遇到了一个问题,我似乎在其他任何地方都找不到答案。最终,我的计划是为我的主题的用户创建一个界面,允许他们更改模板中某些元素的颜色、宽度、位置等。基本上,它将是一个php文件,将生成一个css文档。现在,尽管它所做的只是呼应一句话。我不确定这在技术上是否是一个"插件",但当我试图将它放在插件文件夹中时,我最终出现了404错误。我知道文件在那里,我已经三次检查了路径。我也尝试过直接在url中导航到php文件,但仍然出现404错误。我也尝试过使用插件模板。当我在插件管理器中单击"activate"时,它会呼应这句话,但当从functions.php文件调用它时,它根本不起作用。非常感谢您的帮助。

这是我放在函数末尾的代码。hp:

//begin template specific*******************************************************
//------the function below styles the wordpress admin menus.-------
function custom_style() {
    echo '<style type="text/css">#adminmenu .wp-menu-image img {padding: 0px !important; margin-left: -3px;}</style>';
}
add_action('admin_menu', 'register_custom_menu_page');
add_action('admin_menu', 'custom_style');
//------this function adds the template specific menu item.---------
function register_custom_menu_page() {
    add_menu_page('Epsilon', 'Epsilon', 'add_users', plugins_url('epsilon/eps-manage.php', eps-manage.php ), '',   content_url('themes/epsilon/images/eps-icon.png'), 6);
}   // this function creates the correct path as far as I can tell, but when I click the link button in the admin menu, I get the 404.
//------this function hides the editor option under the appearance menu ----------
function remove_editor_menu() {
    remove_action('admin_menu', '_add_themes_utility_last', 101);
}
add_action('_admin_menu', 'remove_editor_menu', 1);

为什么我会出现这个404错误,有更正确的方法吗?

您正在尝试合并一个插件和一个主题。plugins_url只会加载已注册并激活的插件的文件(不确定是否100%激活)。当你正在开发主题时,最好将你的管理文件与主题文件夹相关,但老实说,对于这种类型的工作,因为你是一名生产工程师,我会将所有内容都保存在functions.php中,并将函数用作菜单的回调。