WordPress.org

Make WordPress Core

Opened 2 years ago

Last modified 7 weeks ago

#20088 closed enhancement

Improve wp_list_comments() comment markup — at Initial Version

Reported by: lancewillett Owned by:
Milestone: 3.6 Priority: normal
Severity: normal Version: 3.3.1
Component: Comments Keywords: has-patch twentythirteen dev-feedback
Focuses: Cc:

Description

The default comment markup generated by wp_list_comments() needs a small revamp. This will potentially help theme authors avoid using their own comment callback functions by incorporating a structure popularized by the last two default themes.

Twenty Twelve, for example, could almost drop the custom comments callback in functions.php with these improvements, with the exception of not being able to use HTML5 semantic elements instead of divs.

Patch has code cleanup and improvements to the comment-template.php file, including:

start_lvl()

  • Use double quotes for HTML output

end_lvl()

  • Add in .children end element HTML comments

start_el()

  • Add switch statement for handling pingback/trackback first, to run before "other" types of comments
  • Add pingback/trackback HTML output based on Twenty Ten / Eleven: much simpler than normal comments
  • Wrap comment_text() in a div element so it can be styled separately
  • Use comment-body class for comment text block, not for the entire wrapper div element
  • Change comment-awaiting-moderation to be wrapped in a paragraph element, removing presentational line break
  • Use updated comment-meta data based on Twenty Ten / Eleven: include an author link (if it exists), better time/date formatting, and use esc_url instead of htmlspecialchars
  • Add in several end element HTML comments
  • Fix spacing around parens
  • Better indenting for PHP and HTML code throughout

end_el()

  • Fix spacing around parens
  • Add in #comment-## end element HTML comments

Change History (1)

lancewillett2 years ago

Note: See TracTickets for help on using tickets.