こんにちは
ショートコードの出力をフィルタリングする do_shortcode_tag フィルターフックぐらいしかなさそうです。
例:
add_filter( 'do_shortcode_tag', function( $output, $tag ) {
if ( 'swpm_registration_form' === $tag ) {
// ここで HTML ($output) を変更
// $output = str_replace( '<input type="text" id="user_name"', '<input type="text" id="user_name" placeholder="名前を入力"', $output );
}
return $output;
}, 10, 2 );
有難うございます!
無事、表示されました。
また、ショートコードの出力方法も教えて頂きまして、有難うございます。
ishitaka様、度々、申し訳ありません。
パスワードの部分についても、同様にplaceholderを使用したく、教えて頂きましたコードを参考に、下記を記載しましたが、表示がされないのですが、この場合は、全く違うコードの書き方になるのでしょうか?
add_filter( 'do_shortcode_tag', function( $output, $tag ) {
if ( 'swpm_registration_form' === $tag ) {
$output = str_replace( '<input type="password" id="password"', '<input type="password" id="password" placeholder="8文字以上の半角英数字"', $output );
}
return $output;
}, 10, 2 );
自身でも、教えて頂いたコードを元に検索してみましたが、(知識不足により)解決に繋がらず、再度ご質問させて頂きました。お手隙の際に、教えて頂けますと幸いです。
パスワードフィールドは、
<input type="password" autocomplete="off" id="password" class="" value="" size="50" name="password">
です。よって、
$output = str_replace( '<input type="password" autocomplete="off" id="password"', '<input type="password" autocomplete="off" id="password" placeholder="8文字以上の半角英数字"', $output );
または、
$output = str_replace( 'id="password"', 'id="password" placeholder="8文字以上の半角英数字"', $output );
こんな感じでしょうか。
とても、ご丁寧に有難うございます。
パスワードフィールドについて、検証モードで確認しましたら、仰せの通りでした(私に確認ミスでした)。
非常に、勉強になり、重ねて感謝申し上げます。