Index: wp-includes/comment-template.php
===================================================================
--- wp-includes/comment-template.php (revision 24986)
+++ wp-includes/comment-template.php (working copy)
@@ -1244,11 +1244,11 @@
case 'div':
break;
case 'ol':
- echo '
' . "\n";
+ $output .= '' . "\n";
break;
default:
case 'ul':
- echo '' . "\n";
+ $output .= '' . "\n";
break;
}
}
@@ -1268,11 +1268,11 @@
case 'div':
break;
case 'ol':
- echo "
\n";
+ $output .= "
\n";
break;
default:
case 'ul':
- echo "\n";
+ $output .= "\n";
break;
}
}
@@ -1331,16 +1331,18 @@
$GLOBALS['comment'] = $comment;
if ( !empty( $args['callback'] ) ) {
+ ob_start();
call_user_func( $args['callback'], $comment, $args, $depth );
+ $output .= ob_get_clean();
return;
}
if ( ( 'pingback' == $comment->comment_type || 'trackback' == $comment->comment_type ) && $args['short_ping'] ) {
- $this->ping( $comment, $depth, $args );
+ $this->ping( $output, $comment, $depth, $args );
} elseif ( 'html5' === $args['format'] ) {
- $this->html5_comment( $comment, $depth, $args );
+ $this->html5_comment( $output, $comment, $depth, $args );
} else {
- $this->comment( $comment, $depth, $args );
+ $this->comment( $output, $comment, $depth, $args );
}
}
@@ -1355,42 +1357,49 @@
*/
function end_el( &$output, $comment, $depth = 0, $args = array() ) {
if ( !empty( $args['end-callback'] ) ) {
+ ob_start();
call_user_func( $args['end-callback'], $comment, $args, $depth );
+ $output .= ob_get_clean();
return;
}
if ( 'div' == $args['style'] )
- echo "\n";
+ $output .= "\n";
else
- echo "\n";
+ $output .= "\n";
}
/**
* @since 3.6
* @access protected
*
+ * @param string $output Passed by reference. Used to append additional content.
* @param object $comment
* @param int $depth Depth of comment.
* @param array $args
*/
- protected function ping( $comment, $depth, $args ) {
+ protected function ping( &$output, $comment, $depth, $args ) {
$tag = ( 'div' == $args['style'] ) ? 'div' : 'li';
+ ob_start();
?>
< id="comment-" >
', '' ); ?>
< id="comment-" >
@@ -1472,6 +1484,7 @@
'',
'format' => current_theme_supports( 'html5', 'comment-list' ) ? 'html5' : 'xhtml',
'short_ping' => false,
+ 'echo' => true,
);
$r = wp_parse_args( $args, $defaults );
@@ -1576,10 +1590,15 @@
if ( empty($walker) )
$walker = new Walker_Comment;
- $walker->paged_walk($_comments, $max_depth, $page, $per_page, $r);
+ $output = $walker->paged_walk($_comments, $max_depth, $page, $per_page, $r);
$wp_query->max_num_comment_pages = $walker->max_pages;
$in_comment_loop = false;
+
+ if ( $r['echo'] )
+ echo $output;
+ else
+ return $output;
}
/**