代码参考
首先找到需要调用评论功能的模板,然后在相应位置添加comments_template()函数(功能:调用评论模板)即可实现调用comments.php模板。
comments_open()函数 //获取当前文章开启了评论功能
评论功能已经关闭
评论功能已经开启
post_password_required()函数 //判断后台密码保护功能开启
have_comments()函数 //判断是否有评论
comment_form()函数 //用此函数生成评论表单
comment_registration// get_option('comment_registration')用户必须注册并登录才可发表评论
wp_list_comments 函数是一个循环输出当前文章或页面每个评论的函数。
$commenter = wp_get_current_commenter();
$req = get_option( 'require_name_email' );
$aria_req = ( $req ? " aria-required='true'" : '' );
$fields = array(
'author' => '
'email' => '
'tel' => '
'comment_field' => '
);
$args = array(
'fields' => $fields,
'title_reply'=>'
输入内容方便咨询我们,我们会在第一时间为您解忧!
','label_submit' => '提交留言',
'comment_field' => false,
'comment_notes_before' => false
);
comment_form($args);
评论功能已经关闭
请输入密码在查看评论内容
没有任何评论你来说两句吧