This is extremely easy and only involves only a few lines of code that can go into functions.php.
[php]
add_action( 'genesis_before_comments' , 'wps_post_type_check' );
function wps_post_type_check () {
if ( is_single() ) {
if ( have_comments() ) {
remove_action( 'genesis_comment_form', 'genesis_do_comment_form' );
add_action( 'genesis_list_comments', 'genesis_do_comment_form' , 5 );
}
}
}
[/php]
If you do not check for comments, then simply removing the form and adding it at the top of the list will remove the form altogether on single pages/posts that have no comments. We do this with a simple function, have_comments().
Nate says
Thanks. This worked perfectly!
Johann says
This is useful. How can remove the ‘website’ option from the comment section? Can you help?
Travis Smith says
Yes, here’s the tutorial: How to Remove the Website Field from Genesis Comments Form
Melissa B. says
Perfect, worked beautifully. Thank you so much! 🙂
Lucy Jane says
Thank you! Works great!!!
Scottish Mum says
Hi, how to remove the form without losing it when there are no comments on a post already. Moving the comments form worked for posts that already had comments, but for those that didn’t already have one, there was no form at all.
Which part of the code should be removed for that. I’ve tried a couple of combos that didn;t work.
Angie says
Quick question on this, I love this code but on this site (post) here: http://demo.strosgirldesigns.com/cocoamommy/2012/07/21/hello-world/ is there a way to move the word COMMENTS to below the comment box?
Travis Smith says
Yes there is. You will need to do this:
[php]
/** Remove Default Comments Heading */
add_filter( ‘genesis_title_comments’, ‘_return_null’ );
add_action( ‘genesis_after_comment_form’, ‘wps_comments_title’ );
/**
* Add Comments Heading
*/
function wps_comments_title() {
‘<h3>’ . _e( ‘Comments’, ‘genesis’ ) . ‘</h3>’; // replace ‘genesis’ with your text domain, if you have one.
}
[/php]
Joyann says
Travis, I get this error when I use your code to move Comments headline below comment box:
Warning: call_user_func_array() [function.call-user-func-array]: First argument is expected to be a valid callback, ‘_return_null’ was given in /home/www/lacarriere.dk/wp-includes
Wonder what needs to be changed?
Travis Smith says
It should be __return_null (with two underscores in the front).
Alexandra says
Thanks for this Travis. I had the exact same problem as Joyann. Now it works beautifully.
Glen Craig says
Perfect instructions. Just what I was looking for, thanks!
Ari Herzog says
Hi Travis this is very helpful as I also wanted to switch the form from below the comments to above them.
How can I remove the lines for “Comments” and “Leave a Comment” — so that the form is only for the name, email, website, and body?
Coralie says
Worked PERFECT!!! Thank you!
Raquel @ My California Roots says
I added this to the end of my funchtions.php and not I cannot access my site. What did I do and what do I need to do to fix it???
Leonard says
Worked for me, too, but when I pasted your code into my functions file, it had smart-quotes. I had to replace them with straight quotes to get it to work.