2012-08-28 44 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中,並使用函數作爲你的菜單的回調函數。

相關問題