Site icon WP Smith

How to Move the Comment Form Above the Comments List in Genesis

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