文章目录
显示
博客文章模板中调用:评论模板comments.php
在博客文章模板single.php的下半部分,注意到有一个叫做 comments_template();的模板标签,它会调用comments.php:
<?php endwhile; endif; ?>
<?php comments_template(); ?>/***调用comments.php***/
</div>
<?php get_sidebar( 'blog' ); ?>
</div>
</div>
<?php get_footer(); ?>
comments.php模板
comments.php模板包含用于创建博客文章的评论表单的所有代码。
登录状态下的评论表单就像这个样子:
如果当我退出登录时,你会看到:这和登录状态下的评论表单字段显示是不同的:
具体取决于我是否登录。
总结的说,所有的评论表单的输出,都是由comments.php模板控制的。
一般来说,我们不需要自定义comments.php模板。但是,如果你想自定义它,最好的办法就是先去另一个默认的WordPress主题,找到comments.php文件,并在它的基础上进行修改,因为这会帮助你考虑到更多的情况,省下不必要的时间浪费。
转载请注明:虚坏叔叔 » WordPress模板层次13:comments.php
♦ 最新资讯 ♦虚幻账号,高速稳定不限流量!立刻购买