Make WordPress Core

Opened 12 years ago

Closed 9 years ago

Last modified 9 years ago

#20446 closed enhancement (fixed)

Add comment form submit button class attribute

Reported by: bainternet's profile bainternet Owned by: sergeybiryukov's profile SergeyBiryukov
Milestone: 4.1 Priority: normal
Severity: normal Version: 3.3.1
Component: Comments Keywords: has-patch
Focuses: Cc:


The comment_form() is packed with filters all over the place to customize the from just the way you need, but one thing i find missing is a class on the submit input tag and if there was a class attribute then it should be filterable.

I know you can set the input ID and simply style based on the ID selector but when designing themes usually you have some kind of class defined for buttons, especially when using any of the html5/responsive theme frameworks and if the comment submit input had a class which was filterable then it would make our lives much easier.

Attachments (1)

comment_form.patch (1.4 KB) - added by bainternet 12 years ago.
patched comment_form function with submit class

Download all attachments as: .zip

Change History (18)

#1 @bainternet
12 years ago

should be very simple , I'll upload a patch as soon as i get home.

12 years ago

patched comment_form function with submit class

#2 @bainternet
12 years ago

  • Keywords has-patch 2nd-opinion needs-testing added

Added patch to handle the comment form submit input class


#3 @bainternet
12 years ago

  • Keywords 2nd-opinion removed

#4 @coffee2code
12 years ago

  • Version set to 3.3.1

Related: #15015 (patch there provides a solution that allows adding 'class' attribute to comment form submit button)

#5 @SergeyBiryukov
10 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #15015.

#6 @ktabori
10 years ago

  • Resolution duplicate deleted
  • Status changed from closed to reopened

Id is not a class and this ticket isn't duplicate.

It's a missed feature for templating, if you use bootstrap or other templating/css frameworks.

I have tested the patch and it works fine.

Last edited 10 years ago by ktabori (previous) (diff)

#7 @SergeyBiryukov
10 years ago

#27232 was marked as a duplicate.

#8 follow-up: @SergeyBiryukov
10 years ago

  • Keywords reporter-feedback added; needs-testing removed
  • Milestone set to Awaiting Review

Looking at the code, .comment-form input[type="submit"] should work for styling purposes:

Why do you need a specific class for that button?

#9 in reply to: ↑ 8 ; follow-up: @spacedmonkey
10 years ago

Replying to SergeyBiryukov:

Looking at the code, .comment-form input[type="submit"] should work for styling purposes:

Why do you need a specific class for that button?

There are lots of reasons why you might want classes on a submit button. In my case, I need it because twitter bootstrap needs a class on all of it's submit buttons to get the correct styling.

#10 in reply to: ↑ 9 @iamdmitrymayorov
10 years ago

Agree with spacedmonkey. No doubt that it is possible to style the button using the id. But if you are using bootstrap and less and do something like this:

#submit {

After compiling, your css file becomes 2Kb heavier because all the bootstrap button styles are now applied one more time to our tiny button. If there was a possibility to add class this could be avoidable. I agree it's not 100% semantically correct but good in terms of saving bandwidth.

#11 @spacedmonkey
10 years ago

Everything else in the form is overridable apart from this one thing. It seems like a small thing and the patch has already been written, I don't see the issue with added this extra functionality?

#12 @SergeyBiryukov
9 years ago

#23281 was marked as a duplicate.

#13 @SergeyBiryukov
9 years ago

  • Keywords reporter-feedback removed
  • Milestone changed from Awaiting Review to Future Release

#14 @rajlaksh
9 years ago

Thank you for opening it :)

#15 @SergeyBiryukov
9 years ago

  • Milestone changed from Future Release to 4.1
  • Owner set to SergeyBiryukov
  • Status changed from reopened to accepted

#16 @SergeyBiryukov
9 years ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In 29809:

Add a class attribute for submit button in comment form.

props bainternet.
fixes #20446.

#17 @DrewAPicture
9 years ago

In 31803:

Add a changelog entry to the DocBlock for comment_form() for the class_submit argument added in 4.1.

See [29809]. See #20446.

Note: See TracTickets for help on using tickets.