How can I show the positive and negative comments for a same post separately?

Well, comments ( if i remember correct and nothing has changed from v4 ) are custom post types, so u can add post_meta to it, like response => true ( positive ) or false ( negative ).

Then u could make custom query ( WP_Comment_Query ) to get comments for certain post with meta parametrs ( ak. Custom Field Parameters )

You would need 2 queries, 1 returning positive, 2-nd – negative comments..

Everything othere depends on you’r design..

Ah yes. When posting a comment you woud need to make some field to save post meta whanever it is positive or negative…

Elaborating my answer:

Ok, for ex. on the front-end ( FE ) u have form, witch submits a comment to a certain post. You would need ( if u don’t have already ) some field that will determine whathere it’s “good” or “bad” comment. Lets call these field response ( and lets imagine that it’s radio button with 2 choices: good and bad as values ).

Then, when user submits form he must select one of the radio buttons and on a php side ( back-end ) you’ll have his answer as (string) $_POST['response'].
so, now u have a variable $response wich contains 1 of radio button values.

Next u would need to insert new comment into database ( for ex. using wp_insert_comment function ) it will return new comment ID.

Next u would need to store your response to these comment using add_comment_meta function passing new comment ID, uniqeue name representing response key in database ( for ex.: _response ) and a value ( $response ) ( last param – unique, better to be true )…

So, now you have comment in database, u have comment meta in database.

Now u can make a query to database to get all comments for some post/page, it would looke like these:

<?php
$args = array(
   'post_id' => get_the_id(), // or if u have some variable u could use it to get all comments from post/page
   'meta_key' => '_response', // from add_comment_meta - unique name representing key in database
   'meta_value' => 'good' // "good" or "bad" or whatever u desire to be
);

// The Query
$comments_query = new WP_Comment_Query;
$comments = $comments_query->query( $args );

// Comment Loop
if ( $comments ) {
    foreach ( $comments as $comment ) {
        $response = get_comment_meta( $comment->comment_ID, '_response', true ); // store response to $response variable for later use
        echo '<p>' . $comment->comment_content . '. <span>These comment is:' . $response . '</span></p>'; // the output of a comment
    }
} else {
    echo 'No comments found.';
}
?>

that way u can get 2 different queryies, 1 with good comments 2-nd with bad comments and echo them in different places on the page ( left side, right side ).

Basicaly it’s the same as with CPT and get_post_meta – only comments…
If u can think how to query CPT with certain meta value – u can do it with comment to..

Related links:
https://codex.wordpress.org/Class_Reference/WP_Comment_Query
https://codex.wordpress.org/Function_Reference/add_comment_meta

If u steel have some questions feel free to ask..

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)