[解決済み] カスタムメンバーフィールドに記入例を付けたい。
タグ: カスタムメンバーフィールド
-
投稿者投稿
-
2013年11月3日 5:25 AM #56759
marin
参加者カスタムメンバーフィールドに記入例を設けたいと思い、記事を参考に以下の通り’usces_filter_custom_field_input’にフィルターをかけてみたのですが、どうしてもエラーになってしまってうまくいきません。
引数の渡し方がよく分かりません。
add_filter( ‘usces_filter_custom_field_input’, ‘my_filter_custom_field_input’, 10, 3 );
function my_filter_custom_field_input($html, $data, $custom_field, $position){
$meta = usces_has_custom_field_meta($custom_field);
$html = preg_replace(‘|([birthday])+”+s+(value=”” />)|’, ‘${0}1999/12/31’, $html);}
エラーメッセージ
Warning: Missing argument 4 for my_filter_custom_field_input()差し支えなければ正しいコードをお教えいただけないでしょうか?
よろしくお願いいたします。。-
このトピックは
nanbuが10年、 3ヶ月前に変更しました。
2013年11月3日 7:22 AM #67872marin
参加者自己解決しました。
引数の数の指定が間違っていました。
2015年7月13日 2:08 PM #74826wtnb
参加者——————————————-
WordPress のバージョン:
Welcart のバージョン:1.4.17
ご利用のテーマ:
症状を確認したブラウザ:
サーバー(会社名、サービス名):
SSLの利用:
WordPress のパーマリンク設定:
——————————————–カスタムメンバーフィールドに例文を記述したい方は多いと思いますので、フックの記述を残しておきます。
add_filter('usces_filter_custom_field_input', 'my_filter_custom_field_input', 1, 4); function my_filter_custom_field_input($html, $data, $custom_field, $position){ $meta = usces_has_custom_field_meta($custom_field); $html = preg_replace('|(\\[birthday\])\\"+\\s+value="" />|', '${0}1999/12/31', $html); return $html; }2020年8月4日 5:10 PM #90525swallow
参加者——————————————-
WordPress のバージョン:5.4.2
Welcart のバージョン:1.9.31
PHP のバージョン:7.3.16
Welcart専用の拡張プラグインとバージョン:SKU Select 1.1.10
ご利用のテーマ:EGO (TCD079/Welcart版)
症状を確認したブラウザ:Chrome
サーバー:
SSLの利用:
——————————————–お世話になります。
上記記事を見つけ、私もカスタムメンバーフィールドに記入例を設けたいと思い、
functios.phpに下記記述をしてみたのですが、うまくいきません。add_filter(‘usces_filter_custom_field_input’, ‘my_filter_custom_field_input’, 1, 4);
function my_filter_custom_field_input($html, $data, $custom_field, $position){
$meta = usces_has_custom_field_meta($custom_field);
$html = preg_replace(‘|(\\[birthday\])\\”+\\s+value=”” />|’, ‘${0}1999/12/31’, $html);
return $html;
}どこが間違えているのか、ご教授いただければと思います。
よろしくお願いいたします。 -
このトピックは
-
投稿者投稿
- このトピックに返信するにはログインが必要です。
PAGE TOP