[wordpress] コメント欄のwebサイト項目削除などカスタマイズする方法

コメント欄のwebサイト項目削除などカスタマイズする方法は以下の通り

comments.phpなどコメント欄を出力するところにcomment_form(変数)を付けると、その変数の値によってコメント欄を変更することができる

<?php
 $comments_args = array(
 'fields' => array(
 'author' => '<p class="comment-form-author">' . '<label for="author">' . __( 'Name' ) . ( $req ? ' <span class="required">*</span>' : '' ) . '</label> ' .
 '<input id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30"' . $aria_req . ' /></p>',
 'email' => '', //email欄削除
 'url' => '', //url欄削除
 ),
 'title_reply' => 'コメントはお気軽にどうぞ',
 'comment_notes_before' => '<p class="comment-notes">メールアドレスは公開されませんのでご安心ください。<br />また、<span class="required">*</span> が付いている欄は必須項目となりますので、必ずご記入をお願いします。</p>',
 'comment_notes_after' => '<p class="form-allowed-tags">内容に問題なければ、下記の「コメントを送信する」ボタンを押してください。</p>',
 'label_submit' => 'コメント送信',
 );

 comment_form($comments_args);
?>

詳しい項目については公式HPにて

https://wpdocs.osdn.jp/%E9%96%A2%E6%95%B0%E3%83%AA%E3%83%95%E3%82%A1%E3%83%AC%E3%83%B3%E3%82%B9/comment_form

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です