WordPress.org

Make WordPress Core

Opened 2 years ago

Last modified 4 weeks ago

#20446 reopened enhancement

Add comment form submit button class attribute

Reported by: bainternet Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 3.3.1
Component: Comments Keywords: has-patch reporter-feedback
Focuses: Cc:

Description

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 2 years ago.
patched comment_form function with submit class

Download all attachments as: .zip

Change History (12)

comment:1 bainternet2 years ago

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

bainternet2 years ago

patched comment_form function with submit class

comment:2 bainternet2 years ago

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

Added patch to handle the comment form submit input class
ex:

comment_form(array('class_submit'=>'myclass'));

comment:3 bainternet2 years ago

  • Keywords 2nd-opinion removed

comment:4 coffee2code2 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)

comment:5 SergeyBiryukov10 months ago

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

Duplicate of #15015.

comment:6 ktabori2 months 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 2 months ago by ktabori (previous) (diff)

comment:7 SergeyBiryukov6 weeks ago

#27232 was marked as a duplicate.

comment:8 follow-up: SergeyBiryukov6 weeks 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:
tags/3.8.1/src/wp-includes/comment-template.php#L2120

Why do you need a specific class for that button?

comment:9 in reply to: ↑ 8 ; follow-up: spacedmonkey5 weeks ago

Replying to SergeyBiryukov:

Looking at the code, .comment-form input[type="submit"] should work for styling purposes:
tags/3.8.1/src/wp-includes/comment-template.php#L2120

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.

comment:10 in reply to: ↑ 9 iamdmitrymayorov4 weeks 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 {
 .btn;
 .btn-primary;
}

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.

comment:11 spacedmonkey4 weeks 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?

Note: See TracTickets for help on using tickets.