/**
Display the comment form via shortcode on singular pages
Remove the default comment form.
Hide the unwanted "Comments are closed" message with CSS.
*
@see http://wordpress.stackexchange.com/a/177289/26350
*/
add_shortcode(
"wpse_comment_form",
function ($atts = array(), $content = "") {
if (is_singular() && post_type_supports(get_post_type(), "comments")) {
ob_start();
comment_form();
print(".no-comments { display: none; }
");
add_filter("comments_open", "__return_false");
return ob_get_clean();
}
return "";
},
10,
2
);