Submitting Comments in WordPress Using Ajax without Refreshing

Publish: 2017-06-22 | Modify: 2017-06-22

Comment Ajax for WordPress

If your WordPress blog does not support Ajax comments, please continue reading. The advantage of Ajax comments is that you can submit comments without refreshing the entire page. This method is suitable for WordPress >= 4.4. If your WordPress version is lower than this, please upgrade first.

ajax-comment

Usage

  1. Download the code from ajax-comment-for-4.4+.zip and extract it to the root directory of your theme.
  2. Modify the functions.php file in your theme directory and add the following code to load the Ajax comment:
require('ajax-comment/main.php');

That's it! However, the comment style may not be fully compatible with your theme. You can modify the app.js file in the code package, around line 4, to customize the CSS style:

__list = 'comment-list';

Other Notes

Before making any code modifications, please make sure to backup your files to avoid any errors that may cause your website to be inaccessible.

This article is referenced from: WordPress Ajax 评论提交


Comments