我整理我的自定義主題,並在調試模式我在我的評論部分得到一個未定義的變量。這是我的自定義註釋部分,顯示的未定義變量是aria_req
,req
和commenter
。這個自定義評論函數在我的函數文件中。我將如何解決這個問題?評論未定義的變量wordpress
// Edit Comment Forms
function alter_comment_form_fields($fields){
$fields['author'] = '<div class="row"><div class="col-md-4"><p class="comment-form-author">' . '<label for="author">' . __('Name') . '</label> ' . ($req ? '<span class="required">*</span>' : '') .
'<input id="author" name="author" type="text" placeholder="Name" value="' . esc_attr($commenter['comment_author']) . '"' . $aria_req . ' /></p></div>';
//Edit Email Field
$fields['email'] = '<div class="col-md-4"><p class="comment-form-author">' . '<label for="email">' . __('Email') . '</label> ' . ($req ? '<span class="required">*</span>' : '') .
'<input id="email" name="email" type="text" placeholder="Email" value="' . esc_attr($commenter['comment_author_url']) . '" "' . $aria_req . ' /></p></div>';
//Edit Website Field
$fields['url'] = '<div class="col-md-4"><p class="comment-form-author">' . '<label for="url">' . __('Website') . '</label> ' . ($req ? '<span class="required">*</span>' : '') .
'<input id="url" name="url" type="text" placeholder="Website" value="' . esc_attr($commenter['comment_author_url']) . '"' . $aria_req . ' /></p></div></div>';
return $fields;
}
add_filter('comment_form_default_fields','alter_comment_form_fields');