How to send add_comment_meta value from separate file to main plugin file?
How to send add_comment_meta value from separate file to main plugin file?
How to send add_comment_meta value from separate file to main plugin file?
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
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
you can disable comments for individual pages from dashboard – pages – all pages: click quick-edit below the page name, then untick allow comments – that should remove the comment form from the page.
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
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
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
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.
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
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