WordPress.org

Make WordPress Core

Opened 3 years ago

Last modified 3 years ago

#30909 new defect (bug)

Allow passing ID for comment_form container and title

Reported by: rmccue Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version:
Component: Comments Keywords: has-patch needs-testing dev-feedback
Focuses: Cc:

Description

Right now, there's a div hardcoded with #respond and a h3 hardcoded with reply-title. These make it hard for the comment form to be used on archive pages, as they assume the comment form is only ever output on single pages.

(There are other IDs output in the form, however these are controllable through id_form and id_submit)

Attachments (2)

30909.diff (17.1 KB) - added by Shelob9 3 years ago.
30909.2.diff (11.5 KB) - added by Ninos Ego 3 years ago.
Cleaned patch withouth formating

Download all attachments as: .zip

Change History (12)

#1 follow-up: @SergeyBiryukov
3 years ago

Note that #respond is also hardcoded in comments_popup_link() and get_cancel_comment_reply_link().

get_comment_reply_link() and get_post_reply_link(), however, have a respond_id argument.

@Shelob9
3 years ago

#2 @Shelob9
3 years ago

  • Keywords has-patch added

I am attaching a path that adds an argument to comment_form() for the hardcoded h3 ID. It also introduces a new function, for the hardcoded #respond ID. The new function returns a filter that can be used to change the value of that ID, sanitizes it and ensures it has a hash, or not, depending on context. That way it can be used for targeting the element in JavaScript, and outputted in HTML.

#3 @SergeyBiryukov
3 years ago

Could you upload a patch without the formatting changes? It would be easier to review. Thanks!

#4 in reply to: ↑ 1 @SergeyBiryukov
3 years ago

Replying to SergeyBiryukov:

Note that #respond is also hardcoded in comments_popup_link() and get_cancel_comment_reply_link().

Related: #28314

#5 @rachelbaker
3 years ago

  • Component changed from Themes to Comments
  • Keywords needs-refresh added
  • Milestone changed from Awaiting Review to Future Release

Patch still needs a refresh.

#6 @rachelbaker
3 years ago

@Shelob9 Interested in refreshing your patch to remove the extra formatting changes?

@Ninos Ego
3 years ago

Cleaned patch withouth formating

#7 @Ninos Ego
3 years ago

  • Keywords needs-refresh removed

I've refreshed his patch and removed the formattings. Hope it's ok now :)

#8 @Ninos Ego
3 years ago

  • Keywords needs-testing added

#9 @Ninos Ego
3 years ago

  • Keywords dev-feedback added

#10 @rachelbaker
3 years ago

#24799 was marked as a duplicate.

Note: See TracTickets for help on using tickets.