Display WordPress comment form using shortcode in between post content area
PHP code helps you to display a small comment form within the content area of a post or page.
Add below codes in function.php file and use shortcode
[codeamend_comment_form]
to display the comment form in post or page content area. add_shortcode( 'codeamend_comment_form', 'codeamend_comment_form_shortcode' );
function codeamend_comment_form_shortcode() {
ob_start();
comment_form();
$cform = ob_get_contents();
ob_end_clean();
return $cform;
}
This code only prints the comment form. If you want to print the entire comment template use the comments_template(); function.
Total Views: 1,293
Posted in WordPress, WordPress Shortcodes
Tagged Add comment form using shortcode in between post content area, comment form shortcode, Comment form WordPress, Display WordPress Comment form using shortcode, WordPress Comment form