Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

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.

share|improve this question

3 Answers 3

up vote 0 down vote accepted

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.

share|improve this answer
    
Thanks, I was afraid of this... –  Florian Feb 14 '12 at 11:30

You Should change the line wp_list_comments to this:

<?php wp_list_comments('reverse_top_level=DESC'); ?>

This could also be controlled from: Administration > Settings > Discussion

share|improve this answer
    
This answer completely misses the point. –  Florian Feb 14 '12 at 11:30

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!

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.