diff --git a/comments.php b/comments.php index f58d4ec..8c90e17 100644 --- a/comments.php +++ b/comments.php @@ -19,11 +19,52 @@ if ( post_password_required() ) { return; } + +// Remove URL field from comments +function sophia_after_dark_remove_url_comments($fields) { + unset($fields['url']); + return $fields; +} +add_filter('comment_form_default_fields', 'sophia_after_dark_remove_url_comments'); + +// Edit Cookie consent text from comments +function sophia_after_dark_comment_form_change_cookies($fields) { + $commenter = wp_get_current_commenter(); + $consent = empty($commenter['comment_author_email']) ? '' : ' checked="checked"'; + $fields['cookies'] = ''; + return $fields; +} +add_filter('comment_form_default_fields', 'sophia_after_dark_comment_form_change_cookies'); + +// Edit comment-notes text from comments +function sophia_after_dark_modify_text_before_comment_form($arg) { + $arg['comment_notes_before'] = wp_kses_post( + '

' . + esc_html__('All comments are manually reviewed and moderated.', 'sophia-after-dark') . + '
' . + esc_html__('Required fields are marked ', 'sophia-after-dark') . + '*

' + ); + return $arg; +} +add_filter('comment_form_defaults', 'sophia_after_dark_modify_text_before_comment_form'); + +// Add note below comment form about privacy policy consent +function sophia_after_dark_modify_text_comment_form($post_id) { + printf( + '%s', + wp_kses( + __('By commenting, you consent to our Privacy Policy', 'sophia-after-dark'), + array('a' => array('href' => array())) + ) + ); +} +add_action('comment_form', 'sophia_after_dark_modify_text_comment_form'); + ?>

@@ -32,15 +73,15 @@ if ( post_password_required() ) { if ( '1' === $sophia_after_dark_comment_count ) { printf( /* translators: 1: title. */ - esc_html__( 'One Remark on “%1$s”', 'sophia-after-dark' ), - '' . get_the_title() . '' + esc_html__( 'One Comment on “%1$s”', 'sophia-after-dark' ), + '' . esc_html(get_the_title()) . '' ); } else { - printf( // WPCS: XSS OK. + printf( /* translators: 1: comment count number, 2: title. */ - esc_html( _nx( '%1$s Remark on “%2$s”', '%1$s Remarks on “%2$s”', $sophia_after_dark_comment_count, 'comments title', 'sophia-after-dark' ) ), + esc_html( _nx( '%1$s Comments on “%2$s”', '%1$s Comments on “%2$s”', $sophia_after_dark_comment_count, 'comments title', 'sophia-after-dark' ) ), number_format_i18n( $sophia_after_dark_comment_count ), - '' . get_the_title() . '' + '' . esc_html(get_the_title()) . '' ); } ?> @@ -60,16 +101,15 @@ if ( post_password_required() ) {

-

\ No newline at end of file + diff --git a/functions.php b/functions.php index a28abc4..6eed9ab 100644 --- a/functions.php +++ b/functions.php @@ -197,32 +197,3 @@ require get_template_directory() . '/inc/metaboxes/mt-post-sidebar-meta.php'; if ( ! function_exists( 'breadcrumb_trail' ) ) { require get_template_directory() . '/inc/mt-class-breadcrumbs.php'; } -//* Remove URL field from comments -function remove_url_comments($fields) { - unset($fields['url']); - return $fields; -} -add_filter('comment_form_default_fields','remove_url_comments'); -//* Edit Cookie consent text from comments -add_filter( 'comment_form_default_fields', 'wc_comment_form_change_cookies' ); -function wc_comment_form_change_cookies( $fields ) { - $commenter = wp_get_current_commenter(); - - $consent = empty( $commenter['comment_author_email'] ) ? '' : ' checked="checked"'; - - $fields['cookies'] = ''; - return $fields; -} -//* Edit comment-notes text from comments -function crunchify_modify_text_before_comment_form($arg) { - $arg['comment_notes_before'] = '

' . __( 'All comments are manually reviewed and moderated.
Required fields are marked *' ) . '

'; - return $arg; -} -add_filter('comment_form_defaults', 'crunchify_modify_text_before_comment_form'); - -add_action( 'comment_form', 'modify_text_comment_form' ); -function modify_text_comment_form( $post_id ) { - printf( '%s', - __( 'By commenting, you consent to our Privacy Policy', 'your_text_domain' ) ); -} \ No newline at end of file