お世話になります。
表題のとおりですが、Wordpressのフォーム作成プラグイン「MW WP Form」について質問させていただきます。
###前提・実現したいこと
「MW WP Form」のタグ生成を
functions.phpで任意の属性などを含めて出力したいと考えています。
###試したこと
/wp-content/plugins/mw-wp-form/classes/models/class.form.php
こちらに type="text" などのタグ生成の記述があるので、現状こちらを修正しています。
lang
1/** 2 * input[type=text]タグ生成 3 * 4 * @param string $name name属性 5 * @param array 6 * @return string html 7 */ 8 public function text( $name, $options = array() ) { 9 $defaults = array( 10 'id' => null, 11 'class' => null, 12 'size' => 60, 13 'maxlength' => null, 14 'value' => '', 15 'placeholder' => null, 16 'conv-half-alphanumeric' => null, 17// ここに追加しています 18 'data-test' => 'test', 19 ); 20 $options = array_merge( $defaults, $options ); 21 $attributes = $this->generate_attributes( $options ); 22 23 return sprintf( 24 '<input type="text" name="%s"%s />', 25 esc_attr( $name ), 26 $attributes 27 ); 28 }
上記方法だとプラグインが更新された際に記述が消えてしまうので、functions.phpで管理したいです。
また、フックというもので、フィルターをかけることができることを知り、
プラグイン公式ページの以下説明を確認したのですが、この中でどれがタグ生成に関わっているか分かりませんでした。
https://plugins.2inc.org/mw-wp-form/manual/filter-hook/
ご教示いただければ幸いです。
どうぞ、よろしくお願いいたします。
あなたの回答
tips
プレビュー