Display comment form of specific page in sidebar

Don’t build your own form and don’t modify comments.php – it’s purpose is little bit different and I don’t think you should include it inside sidebar.

Just put comment_form function call in your sidebar template. It takes 2 parameters: args and post_id.

So you can do it like this:

$args = array(
    ... // your custom arguments (you can leave it empty
);
comment_form( $args, $post_id );

Where should you place this code? Somewhere in your sidebar template. (sidebar.php or something like that, but it depends on your theme).

Leave a Comment