Make WordPress Core

Opened 8 years ago

Closed 7 years ago

#10742 closed defect (bug) (fixed)

Using 'style' => 'ol' in wp_list_comments breaks js

Reported by: esmi Owned by: junsuijin
Milestone: 2.9 Priority: low
Severity: trivial Version: 2.8.4
Component: Comments Keywords: has-patch, tested
Focuses: Cc:



<?php wp_list_comments(array('style' => 'ol')); ?>

in comments.php causes the Reply link to jump to the comment form at the bottom of the list instead of inserting the form within the comment list.

Confirmed using the default theme with no active plugins.

Attachments (1)

comment-reply-for-ol-js-fix.patch (916 bytes) - added by junsuijin 8 years ago.

Download all attachments as: .zip

Change History (5)

#1 @junsuijin
8 years ago

  • Component changed from General to Comments
  • Milestone changed from Unassigned to 2.8.5
  • Owner set to junsuijin
  • Priority changed from normal to low
  • Severity changed from normal to trivial
  • Status changed from new to assigned

I have also encountered this error. While the comment walker can be entirely overridden to bypass the issue, by default the comment walker will not form ol lists the same as ul lists because of the following bits of code in the function start_el:

		<?php if ( 'ul' == $args['style'] ) : ?>
		<div id="div-comment-<?php comment_ID() ?>" class="comment-body">
		<?php endif; ?>
		<?php if ( 'ul' == $args['style'] ) : ?>
		<?php endif; ?>

a simple change to the following will prevent users having to override the comment walker to achieve an ol with js functionality:

		<?php if ( 'div' != $args['style'] ) : ?>
		<div id="div-comment-<?php comment_ID() ?>" class="comment-body">
		<?php endif; ?>
		<?php if ( 'div' != $args['style'] ) : ?>
		<?php endif; ?>

I will attach a patch.

#2 @junsuijin
8 years ago

  • Keywords has-patch tested added

#3 @scribu
8 years ago

  • Cc scribu@… added
  • Keywords comments removed
  • Milestone changed from 2.8.5 to 2.9

#4 @markjaquith
7 years ago

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

(In [12045]) Fix wp_list_comments() ol/ul/div logic oversight. props junsuijin. fixes #10742

Note: See TracTickets for help on using tickets.