2012-08-28 45 views
1

我进入wordpress,我一直在关注一些很不错的教程,并通过阅读代码,但我遇到了一个问题,我似乎无法找到回答其他地方。最终,我的计划是为我的主题的用户创建一个界面,使他们能够更改模板中某些元素的颜色,宽度和位置等。基本上它会是一个会生成一个css文件的php文件。现在尽管它所做的只是回应一个句子。我不确定这是否在技术上是一个“插件”,但是当我尝试将它放入插件文件夹时,最终出现404错误。我知道该文件在那里,我有三重检查路径。我也尝试直接在url中导航到php文件,但我仍然收到404错误。我也尝试使用插件模板。当我在插件管理器中点击“激活”时,它会回应这个句子,但是从functions.php文件调用它时完全不起作用。任何帮助是极大的赞赏。WordPress的无法找到正确的目录中的PHP文件

这里是我已经把我的functions.php结束代码:

//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错误,并在那里做这样的比较正确的做法?

回答

2

您正试图合并插件和主题。 plugins_url只会载入已注册和激活的文件(不能确定激活100%)插件,因为你正在开发一个主题,最好让你的管理文件与你的主题文件夹相关,但老实说这种类型因为你是一个先行者,我会把所有东西放在functions.php中,并使用函数作为你的菜单的回调函数。

相关问题