Skip to main content
added 374 characters in body
Source Link
Shahrukh Khan
  • 431
  • 1
  • 5
  • 19

I have modified the comment query arguments in comment-template.php asfrom

$author_id = get_query_var( 'author_id', 1 );
        $comment_args = array(
                'order'   => 'ASC',
                'orderby' => 'comment_date_gmt',
                'status'  => 'approve',
        );
    $comments = get_comments( $comment_args );

to the following code below

$author_id = get_query_var( 'author_id', 1 );
    if($author_id == '') {
        $comment_args = array(
                'order'   => 'ASC',
                'orderby' => 'comment_date_gmt',
                'status'  => 'approve',
        );
    }
    else { 
        $comment_args = array(
                'order'     => 'ASC',
                'orderby'   => 'comment_date_gmt',
                'status'    => 'approve',
                'meta_key'  => 'custom_author_id',
                'meta_value'=> $author_id,
            );
    }
    $comments = get_comments( $comment_args );

I would like to know how to modify the number of comments being diplayed i.e. get_comments_number()

I have modified the comment query arguments in comment-template.php as

$author_id = get_query_var( 'author_id', 1 );
    if($author_id == '') {
        $comment_args = array(
                'order'   => 'ASC',
                'orderby' => 'comment_date_gmt',
                'status'  => 'approve',
        );
    }
    else { 
        $comment_args = array(
                'order'     => 'ASC',
                'orderby'   => 'comment_date_gmt',
                'status'    => 'approve',
                'meta_key'  => 'custom_author_id',
                'meta_value'=> $author_id,
            );
    }

I would like to know how to modify the number of comments being diplayed i.e. get_comments_number()

I have modified the comment query arguments in comment-template.php from

$author_id = get_query_var( 'author_id', 1 );
        $comment_args = array(
                'order'   => 'ASC',
                'orderby' => 'comment_date_gmt',
                'status'  => 'approve',
        );
    $comments = get_comments( $comment_args );

to the following code below

$author_id = get_query_var( 'author_id', 1 );
    if($author_id == '') {
        $comment_args = array(
                'order'   => 'ASC',
                'orderby' => 'comment_date_gmt',
                'status'  => 'approve',
        );
    }
    else { 
        $comment_args = array(
                'order'     => 'ASC',
                'orderby'   => 'comment_date_gmt',
                'status'    => 'approve',
                'meta_key'  => 'custom_author_id',
                'meta_value'=> $author_id,
            );
    }
    $comments = get_comments( $comment_args );

I would like to know how to modify the number of comments being diplayed i.e. get_comments_number()

Source Link
Shahrukh Khan
  • 431
  • 1
  • 5
  • 19

Get number of comments after modifying comment query

I have modified the comment query arguments in comment-template.php as

$author_id = get_query_var( 'author_id', 1 );
    if($author_id == '') {
        $comment_args = array(
                'order'   => 'ASC',
                'orderby' => 'comment_date_gmt',
                'status'  => 'approve',
        );
    }
    else { 
        $comment_args = array(
                'order'     => 'ASC',
                'orderby'   => 'comment_date_gmt',
                'status'    => 'approve',
                'meta_key'  => 'custom_author_id',
                'meta_value'=> $author_id,
            );
    }

I would like to know how to modify the number of comments being diplayed i.e. get_comments_number()