プラグインで呼び出される関数の引数を変更しようとしています。 プラグイン内の元のコードWordpressはプラグイン内の関数内のargsを置き換えます
orplugin_load_template('templatefile.php', array(
'post_type' => $post_type,
'userdata' => wp_get_current_user(),
'dashboard_query' => $dashboard_query,
'post_type_obj' => $post_type_obj,
'post' => $post,
'pagenum' => $pagenum
));
は、私は私の子供のテーマ
function my_orplugin_load_template('mytemplatefile.php', array(
'post_type' => $post_type,
'userdata' => wp_get_current_user(),
'dashboard_query' => $dashboard_query,
'post_type_obj' => $post_type_obj,
'post' => $post,
'pagenum' => $pagenum
));
ADD_FILTER( 'orplugin_load_template'、 'my_orplugin_load_template'、10)でのfunctions.phpに配置されたバージョンを試しマイ;
mytemplatefile.phpという独自のtemplatefile.phpを作成しました。私はこのファイルをプラグインの外にどこに保存するかを知っていません。それを元のプラグインで置き換える方法。 templatefile.phpの代わりにmytemplatefile.phpをロードします。これを達成する方法は?
あなたは 'orplugin_load_template'というフィルタを使い、 'orplugin_load_template'フィルタの仕組みがわからないようですが、私はこの質問に答えることができないのではないかと恐れています。私はあなたが使用しているプラグインがフィルタを持っていないと思うし、 'add_filter'が何をしているのか誤解しているかもしれません。既存の関数をフィルタリングしません。このコードサンプルでは、関数 'my_orplugin_load_template'は何もしません。 –
良い点。あなたは私に正しい方向を送った。私はWPがプラグインの標準機能を持っていることを知りました: <?php load_template($ _template_file、$ require_once)?> – user5526048