WordPress.org

Make WordPress Core

Ticket #10948: return-wp-list-comments.diff

File return-wp-list-comments.diff, 1.3 KB (added by wonderboymusic, 6 years ago)
  • wp-includes/comment-template.php

     
    14201420        $comment_alt = $comment_thread_alt = 0;
    14211421        $comment_depth = 1;
    14221422
    1423         $defaults = array('walker' => null, 'max_depth' => '', 'style' => 'ul', 'callback' => null, 'end-callback' => null, 'type' => 'all',
    1424                 'page' => '', 'per_page' => '', 'avatar_size' => 32, 'reverse_top_level' => null, 'reverse_children' => '');
     1423        $defaults = array( 'walker' => null, 'max_depth' => '', 'style' => 'ul', 'callback' => null, 'end-callback' => null, 'type' => 'all',
     1424                'page' => '', 'per_page' => '', 'avatar_size' => 32, 'reverse_top_level' => null, 'reverse_children' => '', 'echo' => 1 );
    14251425
    14261426        $r = wp_parse_args( $args, $defaults );
    14271427
     
    14881488
    14891489        if ( empty($walker) )
    14901490                $walker = new Walker_Comment;
    1491 
    1492         $walker->paged_walk($_comments, $max_depth, $page, $per_page, $r);
     1491       
     1492        ob_start();
     1493        $walker->paged_walk( $_comments, $max_depth, $page, $per_page, $r );
     1494        $output = ob_get_clean();
     1495       
    14931496        $wp_query->max_num_comment_pages = $walker->max_pages;
    14941497
    14951498        $in_comment_loop = false;
     1499       
     1500        if ( $r['echo'] )
     1501                echo $output;
     1502        else
     1503                return $output;
    14961504}
    14971505
    14981506/**