WordPress.org

Make WordPress Core

Changeset 9092


Ignore:
Timestamp:
10/06/2008 11:16:26 PM (10 years ago)
Author:
ryan
Message:

Add arg to comments_template() for requesting separating comments by type. see #7635

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/comment-template.php

    r9037 r9092  
    727727 *
    728728 * @param string $file Optional, default '/comments.php'. The file to load
     729 * @param bool $separate_comments Optional, whether to separate the comments by comment type. Default is false.
    729730 * @return null Returns null if no comments appear
    730731 */
    731 function comments_template( $file = '/comments.php' ) {
     732function comments_template( $file = '/comments.php', $separate_comments = false ) {
    732733    global $wp_query, $withcomments, $post, $wpdb, $id, $comment, $user_login, $user_ID, $user_identity;
    733734
    734735    if ( ! (is_single() || is_page() || $withcomments) )
    735736        return;
     737
     738    if ( empty($file) )
     739        $file = '/comments.php';
    736740
    737741    $req = get_option('require_name_email');
     
    748752    }
    749753
    750     // keep $comments for legacy's sake (remember $table*? ;) )
     754    // keep $comments for legacy's sake
    751755    $wp_query->comments = apply_filters( 'comments_array', $comments, $post->ID );
    752756    $comments = &$wp_query->comments;
    753757    $wp_query->comment_count = count($wp_query->comments);
    754758    update_comment_cache($wp_query->comments);
     759
     760    if ( $separate_comments ) {
     761        $wp_query->comments_by_type = &separate_comments($comments);
     762        $comments_by_type = &$wp_query->comments_by_type;
     763    }
    755764
    756765    define('COMMENTS_TEMPLATE', true);
Note: See TracChangeset for help on using the changeset viewer.