$other_post_id = 787; $other_post_comments = get_comments( array( 'post_id' => $other_post_id, ) ); echo '<div id="comments" class="themeform home-comments">'; foreach ( $other_post_comments as $comment ) { $comment = get_comment( $comment ); echo '<div ' . ' id="comment-' . $comment->comment_ID . '" class="home-comment">'; echo '<div class="comment-author vcard">'; echo get_avatar( $comment, 50 ); echo '<cite class="fn">' . get_comment_author_link( $comment ) . '</cite>'; echo '</div>'; echo '<div class="comment-meta commentmetadata">'; printf( __( '%1$s at %2$s', 'text-domain' ), get_comment_date( '', $comment ), get_comment_time(), ); echo '</div>'; echo '<div class="comment-content">'; comment_text( $comment ); echo '</div>'; echo '</div>'; } comment_form( array( 'comment_post_ID' => $other_post_id, 'id_form' => 'commentform', 'class_form' => 'comment-form', ), 787 ); echo '</div>';
Remove redirect to this post after publication
function redirect_after_comment_submission($location, $comment) { $post_id = 787; if ($comment && $comment->comment_post_ID == $post_id) { $location = home_url(); } return $location; } add_filter('comment_post_redirect', 'redirect_after_comment_submission', 10, 2);