Last active
April 1, 2023 05:08
-
-
Save neilgee/2fa511b1e63fe2111946 to your computer and use it in GitHub Desktop.
Add back in HTML Tag Suggestions to Comments in WordPress
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php //<~ don't add me in | |
//Add comment HTML tags | |
//Ref - http://codex.wordpress.org/Function_Reference/comment_form | |
add_filter( 'comment_form_defaults', 'wpb_change_comments' ); | |
function wpb_change_comments( $defaults ) { | |
$defaults['comment_notes_after'] = '<p class="form-allowed-tags">' . sprintf( __( 'You may use these <abbr title="HyperText Markup Language">HTML <abbr> tags and attributes: %s' ), ' <code>' . allowed_tags() . '</code>' ) . '</p>'; | |
$defaults['label_submit'] = __('Post A Reply'); | |
return $defaults; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Filter the default comment form fields. | |
* | |
* @since 3.0.0 | |
* | |
* @param array $fields The default comment fields. | |
*/ | |
$fields = apply_filters( 'comment_form_default_fields', $fields ); | |
$defaults = array( | |
'fields' => $fields, | |
'comment_field' => '<p class="comment-form-comment"><label for="comment">' . _x( 'Comment', 'noun' ) . '</label> <textarea id="comment" name="comment" cols="45" rows="8" aria-required="true" required="required"></textarea></p>', | |
/** This filter is documented in wp-includes/link-template.php */ | |
'must_log_in' => '<p class="must-log-in">' . sprintf( __( 'You must be <a href="%s">logged in</a> to post a comment.' ), wp_login_url( apply_filters( 'the_permalink', get_permalink( $post_id ) ) ) ) . '</p>', | |
/** This filter is documented in wp-includes/link-template.php */ | |
'logged_in_as' => '<p class="logged-in-as">' . sprintf( __( '<a href="%1$s" aria-label="Logged in as %2$s. Edit your profile.">Logged in as %2$s</a>. <a href="%3$s">Log out?</a>' ), get_edit_user_link(), $user_identity, wp_logout_url( apply_filters( 'the_permalink', get_permalink( $post_id ) ) ) ) . '</p>', | |
'comment_notes_before' => '<p class="comment-notes"><span id="email-notes">' . __( 'Your email address will not be published.' ) . '</span>'. ( $req ? $required_text : '' ) . '</p>', | |
'comment_notes_after' => '', | |
'id_form' => 'commentform', | |
'id_submit' => 'submit', | |
'class_form' => 'comment-form', | |
'class_submit' => 'submit', | |
'name_submit' => 'submit', | |
'title_reply' => __( 'Leave a Reply' ), | |
'title_reply_to' => __( 'Leave a Reply to %s' ), | |
'title_reply_before' => '<h3 id="reply-title" class="comment-reply-title">', | |
'title_reply_after' => '</h3>', | |
'cancel_reply_before' => ' <small>', | |
'cancel_reply_after' => '</small>', | |
'cancel_reply_link' => __( 'Cancel reply' ), | |
'label_submit' => __( 'Post Comment' ), | |
'submit_button' => '<input name="%1$s" type="submit" id="%2$s" class="%3$s" value="%4$s" />', | |
'submit_field' => '<p class="form-submit">%1$s %2$s</p>', | |
'format' => 'xhtml', | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment