I am using comment_form(); in loop-single.php file to show the comment form. I have the following fields in it: Name, Email, Website, Title, Comment. Currently all these form fields show underneath each other. I tried to modify the form in such a way so that all textbox values appear in left column & only the textarea appears in the right column.
I tried to use comment_notes_after, comment_notes_before, comment_form_top, etc. so far but met with no success. So how can I achieve this (Any working code will be greatly appreciated)?
What you need are two new containers: one for the single line fields, one for the textarea. Looking at the default comment form, we can see where their start and end tags should appear. I have added some comments to make that easier to see:
'comment_form_top'
. Not later because we have to catch the case of a user who is logged in.'comment_form_after_fields'
.'comment_form_field_comment'
. This one is a filter, not an action.In the following sample code I throw a
style
element into the markup. In your theme you should put the CSS into the style sheet. And you should use a clearfix handler of your choice, not the markup I used here. 🙂Result in TwentyEleven
Not exactly beautiful, you have to adjust the CSS. But the general way should be clear now.