Make WordPress Core

Opened 8 years ago

Closed 8 years ago

#34170 closed enhancement (fixed)

Add form class argument to comment_form()

Reported by: flixos90's profile flixos90 Owned by: drewapicture's profile DrewAPicture
Milestone: 4.4 Priority: normal
Severity: normal Version:
Component: Comments Keywords: has-patch dev-feedback
Focuses: template Cc:

Description

When using the comment_form() function, it is currently not possible to adjust the class of the form. ID can be adjusted, and for example the submit's ID and class can also be adjusted. So I thought it would be straightforward to add the same for the form tag itself.

Use-case: I'm using a theme based on Bootstrap, and I would like to have a horizontal comment form for which I need to apply a class 'form-horizontal' to the form tag. Right now I can only do that by outputting the whole form manually, including all the actions and filters which is a pain to manage when I would rather just create markup. I'd much rather use the built-in comment_form() function instead and only adjust the arguments there.

Attachments (2)

34170.patch (1.9 KB) - added by flixos90 8 years ago.
Patch to address the issue (includes docs)
34170.2.patch (2.3 KB) - added by flixos90 8 years ago.
Added new argument to changelog

Download all attachments as: .zip

Change History (6)

@flixos90
8 years ago

Patch to address the issue (includes docs)

#1 @flixos90
8 years ago

  • Keywords has-patch dev-feedback added

#2 @DrewAPicture
8 years ago

  • Milestone changed from Awaiting Review to 4.4

Hi @flixos90, thanks for the patch. Could you also add the new argument to the list in the 4.4.0 changelog entry in the DocBlock please?

@flixos90
8 years ago

Added new argument to changelog

#3 @flixos90
8 years ago

@DrewAPicture Thanks for the quick response! The new argument is now in the DocBlock.

#4 @DrewAPicture
8 years ago

  • Owner set to DrewAPicture
  • Resolution set to fixed
  • Status changed from new to closed

In 34871:

Template: Introduce a new class_form argument in comment_form(), allowing customization of the form class attribute.

The static 'comment-form' class was originally added to comment_form() in [24525]. This new argument should provide needed flexibility in styling the comment form further.

Props flixos90.
Fixes #34170. See #23851.

Note: See TracTickets for help on using tickets.