为WordPress添加ajax评论
在Wordpress中使用ajax评论是很有必要的,这样可以增强用户体验。Wordpress有很多ajax评论的插件,但会增加系统负担,不是很好,下面就来介绍一个不用插件添加ajax的方法。
1、下载相关文件:comments-ajax (91)
下载解压后将comments-ajax.js和comments-ajax.php上传到你的主题的目录中。
2、在你的主题文件中编辑header.php
找到
1 | <?php if (is_singular()) wp_enqueue_script('comment-reply'); ?> |
替换为
1 2 3 4 | <?php if (is_singular()){ ?> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.2.3/jquery.min.js"></script> <script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/comments-ajax.js"></script> <?php } ?> |
然后你就可以使用ajax评论了。
原文:http://kan.willin.org/?p=1271
本文永久链接地址: http://www.cngry.com/archives/wordpress-ajax-comment-no-plugins.html
本文短网址:http://gry.im/1350
转载请注明: 转载自gry's blog
如果你觉得本博内容不错,欢迎 [订阅 gry's blog],以便第一时间了解本博更新内容!


:t17 试试
来试试
[...] 转自gry’s blog [...]
淡淡的
那还不好
来试试效果哈。。好用便拿走
测试一下嘻嘻 ~
这个代码有和不同?
试试~~