Hot answers tagged

4

From WordPress Version 4.1 (trac ticket #20446) it's now added to pass your own class as an argument of comment_form($args) using 'class_submit' array key: $args = array( 'class_submit' => 'btn btn-default' ); No need to do extra hard work. (Edited the Codex too) :)


3

If you need to modify the max depth, you could use the thread_comments_depth_max filter: /** * Set max comments depth to 15 on the discussion settings page */ add_filter( 'thread_comments_depth_max', function( $max ) { return 15; } ); then the dropdown on the discussion settings page will show the range 1 - 15. But I can imagine very deep comment ...


3

We could rewrite: wp_list_comments( array( 'callback' => 'bootstrap_comment_callback', )); with the null walker parameter: wp_list_comments( array( 'walker' => null, 'callback' => 'bootstrap_comment_callback', )); which means we are using the default Walker_Comment class: wp_list_comments( array( 'walker' ...


3

This is possible using the comment_post action, and the GFAPI class which handles entries in WordPress. What you need to first is add using comment_form_default_fields a field which is a checkbox. function add_to_email_list_field($fields) { $fields['add-to-email'] = '<p class="comment-form-public"> <input id="addtoemail" ...


2

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 ...


2

Re-arranging the comment fields The comment text area has been moved to the top in WordPress 4.4: What if we prefer the old setup, where it was at the bottom? Re-arranging the author, url and email comment fields We can modify the display order, of the author, url and email fields, with: /** * Re-arranging the author, url and email comment fields */ ...


1

You could use flexbox instead of table if wanting to do this with css. Flexbox lets you order elements easily: #commentform { display: flex; flex-flow: column; } .comment-form-comment { order: 1; } .comment-form-url { order: 2; } .comment-form-email{ order: 3; } .comment-form-author{ order: 4; } .form-submit{ order: 5; } Here's ...


1

Welcome to WSE. This tut maye be helpful http://www.sitepoint.com/design-a-multi-page-form-in-wordpress-introduction/ However, I don't see why you wouldn't use a form plugin to achieve this. Any of the following should do the job for you Breezing Forms, Gravity Forms, Contact 7 forms, Formidable Forms, Easy Form Maker, Ninja Forms, Contact Form Manager, ...


1

WP_Comment_Query doesn't pull comment meta. You can search by comment meta but the query doesn't return that data. You could easily check this yourself by looking at the Codex. You need to loop over the results and run get_comment_meta(), or essentially do the same via a filter on the_comments. It is also possible to add to the data returned by filtering ...


1

I'm not sure I fully understand your question, but to add some HTML (just over or under the submit field) that is visible to both logged-in and logged-out users, you can try the following: add_filter( 'comment_form_submit_field', function( $submit_field ) { //----------------------------------- // Adjust the prepend to your needs ...


1

You can not enable comments in future posts. Those posts are not public and are not private, so they verify the conditional in line 61 of wp-comments-post.php file; that conditional is (WP 4.1.1): } elseif ( ! $status_obj->public && ! $status_obj->private ) { /** * Fires when a comment is attempted on a post in draft mode. * ...


1

If you have something like _e('') just change it to something like _e('','a4jp') In this example, a4jp is the theme name (theme-slug).


1

Solution if submit button disappears and notes: In case you lose the submit button of your form, in addition to Pieter Goosen's answer, you should add those lines to the defaults array parameters list: 'submit_button' => '<input name="%1$s" type="submit" id="%2$s" class="%3$s" value="%4$s" />', 'submit_field' => '<p ...


1

You should be able to change the HTML structure for the comment form's submit, with the comment_form_defaults filter. Here's an untested example: add_filter( 'comment_form_defaults', function( $defaults ) { // Edit this to your needs: $button = '<input name="%1$s" type="submit" id="%2$s" class="%3$s" value="%4$s" />'; // Override the ...



Only top voted, non community-wiki answers of a minimum length are eligible