WordPress.org

Make WordPress Core

Opened 3 years ago

Last modified 3 weeks ago

#41009 new enhancement

Add filter to comment form class

Reported by: cjbj Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version:
Component: Comments Keywords: has-patch commit
Focuses: Cc:
PR Number:

Description

Almost all html of the comment_form function can be customized using filters, except for this line (current 2285 in comment-template.php), which is the wrapping div of the comment form:

<div id="respond" class="comment-respond">

I feel there are legitimate reasons for wanting at least the class to be filterable. For instance if you are using the clearfix class throughout your design to clear floats. So I would like to propose changing this line to this:

$respond_class = 'comment-respond';
$respond_class = apply_filters ('comment_form_respond_class' ,$respond_class);
echo '<div id="respond" class="' . esc_attr($respond_class) . '">';

Attachments (1)

41009.patch (677 bytes) - added by yahil 3 years ago.

Download all attachments as: .zip

Change History (4)

#1 @cjbj
3 years ago

  • Keywords has-patch added
  • Type changed from feature request to enhancement

@yahil
3 years ago

#2 @earnjam
6 months ago

  • Version 4.7 deleted

#3 @andraganescu
3 weeks ago

  • Keywords commit added
  • Milestone changed from Awaiting Review to Future Release

I have tested this patch and it works very well. Allowing a filter for the class of the comment wrapper is indeed a minor enhancement, but nevertheless a logical one considering that almost all the other parts of that form are filterable.

Note: See TracTickets for help on using tickets.