Is there a way to display the comment field first and then the Name / Email / Website fields? I am using
<?php comment_form( ); ?>
in my theme. I am not looking for a CSS solution.
Some loose implementation of where I would start. The hooks 'comment_form_default_fields'
, 'comment_form_defaults'
, and the 'comment_form_{location}'
hooks look promising. Line 1569 of comment-template.php is doing the fields, and line 1575 is doing the main field, you might be able to "trick" wordpress into putting the comment field up top...but all that seems like it would take a lot of tinkering and time to get perfect, CSS is probably the best way to go about this unfortunately.
Whilst this might not be the most advisable Wordpress way to do it, I could find no other solution.
I went digging for the place where the actual comment form is rendered. I found it in:
/wp-includes/comment-template.php
Search for:
function comment_form(...
This is the function which creates the comment form, and applies all of the filters you might set.
So, I just went ahead and copied that function to my theme functions.php and renamed it to something different like:
function mytheme_comment_form(...
Then in my template I call <?php mytheme_comment_form() ?>
With my own function I'm able to switch the fields around however I want them.
The more I played with comment_form()
the less I could really see the point of it. Having all of the form html in comments.php
like it originally was just seemed smarter for this case as I could easily move the stuff around as I wanted it and it made me feel slightly less dirty than doing the above did :)
Anyway, that's a possible solution, no idea if it would end up breaking something but I think it's fairly sound and I'm going to run with it!