How to create a classified section in place of comments_template

It will be a three step process. You can use comment_form_logged_in_after (for logged in users) and/or comment_form_after_fields (for non-logged in users) actions to add your custom fields. Save the values as comment meta using update_comment_meta function hooked into comment_post action. Get the values using get_comment_meta. EDIT: 25-05-2022 Try this.. /* * This will add the … Read more

wp-comment-post.php and header already sent issues

Okay, just looking through this code quickly, it looks like the problem may be that the getImgID() function is echoing rather than returning its output. This function is called from within another function, guan_getImgID_inserter(), that is hooked into the comment_text filter hook. Anything that filters comment_text (or any filter hook, for that matter), should be … Read more

Create customized captcha field to wordpress comment form without Plugin

Check out the default comment-template.php file: wp-includes/comment-template.php You will need to replace the arguments: $defaults = array( ‘fields’ => apply_filters( ‘comment_form_default_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”></textarea></p>’, ‘must_log_in’ => ‘<p class=”must-log-in”>’ . sprintf( __( ‘You must be <a href=”https://wordpress.stackexchange.com/questions/174775/%s”>logged in</a> to post … Read more

How to add a category to comments?

OK, I finally made it following this crystal clear tut Consequently, my functions.php became: add_action( ‘comment_form_logged_in_after’, ‘additional_fields’ ); add_action( ‘comment_form_after_fields’, ‘additional_fields’ ); function additional_fields () { echo ‘<p class=”comment-form-title”>’. ‘<label for=”title”>’ . __( ‘Titre (Je peux…)’ ) . ‘</label>’. ‘<input id=”title” name=”title” type=”text” size=”30″ tabindex=”5″ /></p>’; echo ‘<strong><label for=”category”>Cette solution est particulièrement utile…</label></strong> <select id=”category” … Read more

Custom comment-field form arrangement [closed]

Sure, you could use the comment_form_field_comment filter to inject content (extra fields or whatever) above the comment field: function comment_form_field_comment_add_field( $field ) { $new_field = ‘<p class=”comment-form-extra”><label for=”extra”>Extra Field</label> <input id=”extra” name=”extra” type=”text” value=”” size=”30″ aria-required=”true” required=”required”></p>’; $field = $new_field . $field; return $field; } add_filter( ‘comment_form_field_comment’, ‘comment_form_field_comment_add_field’ ); You could also switch that around … Read more

Custom markup for the comment form

Yeah this should be possible using the comment_form_default_fields filter, like so: apply_filters( ‘comment_form_default_fields’, $fields ); $fields = array( ‘name’ => ‘<section class=”form-group”> <input type=”text” class=”form-control” id=”name” placeholder=”Your name” /> </section>’ ); Just remember to add any other fields that you want to add into that array too.

Commentform input area issue

Try adding the code to the comment-template.php file located in wp-includes, right under the function get_comment_author_link( $comment_ID = 0 ) { /** @todo Only call these functions when they are needed. Include in if… else blocks */ $url = get_comment_author_url( $comment_ID ); $author = get_comment_author( $comment_ID ); if ( empty( $url ) || ‘http://’ == … Read more

Wrapping the cancel_comment_reply_link()

The link markup passes through the filter named, guess what, cancel_comment_reply_link. Something along the lines of (not tested): add_filter( ‘cancel_comment_reply_link’, function( $formatted_link ) { return ‘before’ . $formatted_link . ‘after’; } ); It will still get wrapped into <small> in comment_form() later though, which might or might not be relevant and unfortunately seems hard to … Read more