put stuff where it should be :3

This commit is contained in:
2024-07-29 00:46:48 -07:00
parent 70166b72d1
commit 7c9b4efdb4
2 changed files with 49 additions and 38 deletions

View File

@ -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'] = '<p class="comment-form-cookies-consent"><input id="wp-comment-cookies-consent" name="wp-comment-cookies-consent" type="checkbox" value="yes"' . esc_attr($consent) . ' /><label for="wp-comment-cookies-consent">' . esc_html__('Save my Name & Email for the next time I comment.', 'sophia-after-dark') . '</label></p>';
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(
'<p class="comment-notes">' .
esc_html__('All comments are manually reviewed and moderated.', 'sophia-after-dark') .
'<br><span class="required-field-message">' .
esc_html__('Required fields are marked ', 'sophia-after-dark') .
'<span class="required">*</span></span></p>'
);
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(
'<span class="submit-comment-note">%s</span>',
wp_kses(
__('By commenting, you consent to our <a href="/privacy-policy">Privacy Policy</a>', 'sophia-after-dark'),
array('a' => array('href' => array()))
)
);
}
add_action('comment_form', 'sophia_after_dark_modify_text_comment_form');
?>
<div id="comments" class="comments-area">
<?php
// You can start editing here -- including this comment!
if ( have_comments() ) :
?>
<h2 class="comments-title">
@ -32,15 +73,15 @@ if ( post_password_required() ) {
if ( '1' === $sophia_after_dark_comment_count ) {
printf(
/* translators: 1: title. */
esc_html__( 'One Remark on &ldquo;%1$s&rdquo;', 'sophia-after-dark' ),
'<span>' . get_the_title() . '</span>'
esc_html__( 'One Comment on &ldquo;%1$s&rdquo;', 'sophia-after-dark' ),
'<span>' . esc_html(get_the_title()) . '</span>'
);
} else {
printf( // WPCS: XSS OK.
printf(
/* translators: 1: comment count number, 2: title. */
esc_html( _nx( '%1$s Remark on &ldquo;%2$s&rdquo;', '%1$s Remarks on &ldquo;%2$s&rdquo;', $sophia_after_dark_comment_count, 'comments title', 'sophia-after-dark' ) ),
esc_html( _nx( '%1$s Comments on &ldquo;%2$s&rdquo;', '%1$s Comments on &ldquo;%2$s&rdquo;', $sophia_after_dark_comment_count, 'comments title', 'sophia-after-dark' ) ),
number_format_i18n( $sophia_after_dark_comment_count ),
'<span>' . get_the_title() . '</span>'
'<span>' . esc_html(get_the_title()) . '</span>'
);
}
?>
@ -60,16 +101,15 @@ if ( post_password_required() ) {
<?php
the_comments_navigation();
// If comments are closed and there are comments, let's leave a little note, shall we?
if ( ! comments_open() ) :
?>
<p class="no-comments"><?php esc_html_e( 'Comments are closed.', 'sophia-after-dark' ); ?></p>
<?php
endif;
endif; // Check for have_comments().
endif;
comment_form();
?>
</div>
</div>

View File

@ -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'] = '<p class="comment-form-cookies-consent"><input id="wp-comment-cookies-consent" name="wp-comment-cookies-consent" type="checkbox" value="yes"' . $consent . ' />' .
'<label for="wp-comment-cookies-consent">'.__('Save my Name & Email for the next time I comment.', 'textdomain').'</label></p>';
return $fields;
}
//* Edit comment-notes text from comments
function crunchify_modify_text_before_comment_form($arg) {
$arg['comment_notes_before'] = '<p class="comment-notes">' . __( 'All comments are manually reviewed and moderated.<br><span class="required-field-message">Required fields are marked <span class="required">*</span></span>' ) . '</p>';
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( '<span class="submit-comment-note">%s</span>',
__( '<i>By commenting, you consent to our <a href="/privacy-policy">Privacy Policy</a></i>', 'your_text_domain' ) );
}