admin管理员组文章数量:1335427
I have created a custom page template, but I don't know how to add the WordPress comment form to my <body>
tag.
I tried to include the following in my template.php
file in the body tag, but the form won't show up:
<?php $comments_args = array('label_submit' => __( 'Send', 'textdomain' ), 'title_reply' => __( 'Write a Reply or Comment', 'textdomain' ), 'comment_notes_after' => '',
'comment_field' => '<p class="comment-form-comment"><label for="comment">' . _x( 'Comment', 'noun' ) . '</label><br /><textarea id="comment" name="comment" aria-required="true"></textarea></p>',
);
comment_form( $comments_args ); ?>
I am using the child theme of twenty seventeen themes.
I have created a custom page template, but I don't know how to add the WordPress comment form to my <body>
tag.
I tried to include the following in my template.php
file in the body tag, but the form won't show up:
<?php $comments_args = array('label_submit' => __( 'Send', 'textdomain' ), 'title_reply' => __( 'Write a Reply or Comment', 'textdomain' ), 'comment_notes_after' => '',
'comment_field' => '<p class="comment-form-comment"><label for="comment">' . _x( 'Comment', 'noun' ) . '</label><br /><textarea id="comment" name="comment" aria-required="true"></textarea></p>',
);
comment_form( $comments_args ); ?>
I am using the child theme of twenty seventeen themes.
Share Improve this question edited Aug 22, 2018 at 8:39 Jacob Peattie 44.1k10 gold badges50 silver badges64 bronze badges asked Aug 22, 2018 at 2:38 JoeBeJoeBe 1031 silver badge4 bronze badges1 Answer
Reset to default 1If you want to display default Wordpress comment form then you need to call comments_template()
in your template. Make sure that comment_status
should be open
for the particular post that you want to display the comment form.
<?php
comments_template();
?>
Read more here https://developer.wordpress/reference/functions/comments_template/
本文标签: Comment form on custom page template
版权声明:本文标题:Comment form on custom page template 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742243742a2438999.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论