私は簡単なWordpressのプラグインのためのファイルを維持するために作曲家を使用しようとしています。 - クラスを必要とし、Wordpressの 不正確なバージョンを含む作者の自動ロード
WP_Custom_Menu_Widget.php
とウィジェットを登録したファイル - メインウィジェットクラスWP_Widget_Base.php
- WP_Custom_Menu_Widget.php
Iによって拡張
dmg_custom_menu_widget.php
:プラグインコードは、3つのファイルを使用していますコンポーザーを使用してプラグインコードをインストールし、依存関係を取得します。私が手require_once 'vendor/autoload.php';
:ファイルは、このような作曲の自動ロードファイル使用
dmg_custom_menu_widget.php
で含まれている場合は「致命的なエラー:未定義のメソッドの呼び出し...」それが使用さ
WP_Widget_Base.php
の古いバージョンを含めているので、 dmg-custom-menu-widgetのベースディレクトリの外に別のウィジェットプラグインによって作成されます。ファイルが使用
dmg_custom_menu_widget.php
によって直接含まれている場合:正しいファイルが含まれているので、私はエラーを取得していないrequire_once 'vendor/DMG/WP_Widget_Base/src/WP_Widget_Base.php'; require_once 'src/WP_Custom_Menu_Widget.php';
を。
plugins/ dmg-related-pages-widget/ vendor/ DMG/ WP_Widget_Base/ src/ WP_Widget_Base.php <- File being included dmg-custom-menu-widget/ dmg_custom_menu_widget.php <- Calls require_once 'vendor/autoload.php' vendor/ autoload.php <- Composer autoload file DMG/ WP_Widget_Base/ src/ WP_Widget_Base.php <- File that should be included
追加情報
フォルダ
dmg-related-pages-widget
が削除されている場合は、正しいファイルが含まれています:これは、関連するフォルダ構造です。
Composer.json
{ "name" : "DMG/WP_Custom_Menu_Widget", "license" : "GPL-3.0", "repositories": [ { "type": "git", "url": "https://[email protected]/dgifford/wp_widget_base.git" } ], "require": { "DMG/WP_Widget_Base" : "dev-master" }, "autoload": { "classmap": [ "src/WP_Custom_Menu_Widget.php" ] } }
あなたに 'composer.json'を追加できますか?私はこのプラグインのオートロードを自分で追加したと思いますよね? – vfsoraki
私はcomposer.jsonファイルを追加しました。コンポーザーによるオートローディング。 – theHands