1

私はワードプレスを始めており、かなり良いチュートリアルに従ってコーデックスを読んでいますが、他のどこにも答えが見つからないように見える問題に遭遇しました。最終的には、テーマのユーザーがテンプレート内の特定の要素の色、幅、配置などを変更できるようにするインターフェイスを作成する予定です。基本的に、css ドキュメントを生成する php ファイルになります。現時点では、文をエコーするだけですが。これが技術的に「プラグイン」であるかどうかはわかりませんが、プラグイン フォルダーに入れようとすると、404 エラーが発生します。私はファイルがそこにあることを知っており、パスをトリプルチェックしました。URLで直接phpファイルに移動しようとしましたが、それでも404エラーが発生します。プラグイン テンプレートも使用してみました。プラグイン マネージャーで「アクティブ化」をクリックすると、この文がエコーされますが、functions.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 エラーが発生するのはなぜですか? もっと正しい方法はありますか?

4

1 に答える 1

2

プラグインとテーマをマージしようとしています。plugins_url は、登録されてアクティブ化された (100% のアクティブ化については不明) プラグインのファイルのみをロードします。あなたは初心者なので、すべてを functions.php に保存し、関数をメニューへのコールバックとして使用します。

于 2012-08-28T19:05:35.887 に答える