建立留言模板
三 12, 2010 | wordpress 主题 |
第一步
• 创建一个新文件:comments.php.
• 把我的 comments.txt 文件中的内容拷贝到你的 comments.php。
• 保存 comments.php 文件。
第二步
• 把我的 comments-template-css 文件中的内容拷贝到你的 style.css 文件中。
• 复制到 style.css 的底部或者刚好 #footer 的上面。
第三步
在 single.php 文件中,entry DIV 的下面,输入以下代码:
<div class=”comments-template”>
<?php comments_template(); ?>
</div>
comments_template() 这个函数是用来从 comments.php 文件调用评论模板。 comments.php 文件然后就会根据它的模板(或者代码)去显示评论列表。列表中的每个条目是一条评论。
你同样可以把 comments_template() 函数用到 page.php 文件以让人们可以在静态页面也可以留言。是否这么做取决于你,如果你喜欢,重复上面的三步修改 page.php 文件。
第四步
第四步是验证你的代码,然而可以不进行第四步的,因为你在使用的是我已经整理过的默认主题评论模板的修改版。我已经替你验证过代码了。
验证:
• 查看 > 页面源代码
• 拷贝所有源代码
• 然后到 validator。
• 把你的代码粘贴到 Direct Input 框中。
• 点击 Check。





留下您的脚印