how to have 2 comments_template() in one post

i could not solve the main problem (two comments_template() in one post) but i created a new post_type for “talk to teacher” part and so we will create a post for every teacher in that post type and put the link of that post in teacher's profile page. by clicking on that link, students will go to new post that can just comment for the teacher and talk with her/him.
.

so by the following code, we can find that post in the new post_type to be used in the profile page:
consider: also in the new post, the author is the same.

<?php
$author_id = get_the_author_meta( 'ID' );
$post_ids = get_posts(array( 'fields' => 'ids', 'author' => $author_id, 'post_type' => 'talk', ));
$num = 0;
foreach($post_ids as $post_id) :        
    echo "<a href="". get_permalink( $post_id )."">talk to your teacher</a></br>";
    // the following condition, consider the last post that has created for the teacher to talk with students 
    $num = $num + 1;
    if ($num >= 1){
        break;
    }
endforeach;
?>

Leave a Comment