Coding, Web, Hydrology and more.

A Light and Fast Disqus Comment Plugin for WordPress

A

0x00 Why should I use Disqus?

Disqus is an American blog comment hosting service for web sites and online communities that use a networked platform. The company’s platform includes various features, such as social integration, social networking, user profiles, spam and moderation tools, analytics, email notifications, and mobile commenting.

In short, Disqus offers free and premium comment service which can be integrated into Wordpress, and this service can help you prevent from most spams that you could see when you are using original WordPress commenting system, and you don’t have to worry about increasing comments will take up your database’s space and slow down database’s reponse because comments data are stored on Disqus’ server. Moreover, your would increase your website page load speed using Disqus thanks to the removal of loading original commenting system logic and data.

0x01 How can I install Disqus on my WordPress site?

As a matter of fact, the Disqus Dev team has already offered you a plugin to help you setup Disqus on your WordPress site, so what I am writing another plugin for when there is already one to use?

  1. Disqus cannot be loaded normally at sometimes, because of poor network connection or some other reasons;
  2. Disqus cannot be accessed from some countries due to policy restriction;
  3. Disqus has great performance impact on page load speed score like PageSpeed.

Therefore, I am here to provide you a solution to import Disqus comment system to your site with minimum performance impact.

This plugin use Disqus RESTful API when Disqus server is unable to reach, using RESTful API will increase load speed significantly because only text data is fetched from remote, and this remote can be adjusted to adapt your network condition.

To install this plugin:

  1. Download DisqusJs WordPress plugin from here;
  2. Upload, Install and Activate this plugin through WordPress admin page -> Plugins -> Add new -> Upload Plugin;
  3. Open plugin configuration page from WordPress admin page -> Settings -> disqusjs
  4. Setting up Disqus for your site.

DisqusJs Setting Page

There are two key options you need to setup for disqus to run normally on your site.

  1. Disqus Shortname: this is identifier for DisqusJs to load your site, you will have a shortname when create site on https://disqus.com/admin/create/
  2. Disqus API Key: this create DisqusJs’s access to Disqus API, you can create one from: https://disqus.com/api/applications/register/;

And following are other optional settings:

  1. Disqus API Endpoint: This option is for some users who cannot access Disqus directly, those users would use this endpoint to access Disqus’ data. By default it is “https://disqus.edlinus.cn/api/”, you can change it to “https://disqus.skk.moe/disqus/” if disqus don’t load properly;
  2. Disqus Max Comment Nesting Level: This option’s default value is 4, if you want to see a more nested comment, you can change this value to bigger one;
  3. Disqus Admin User Name: Your site’s disqus admin user’s name, you can find it on Disqus – Settings – Account – Username;
  4. Disqus Admin Badge Name: A badge would be displayed on comment list if a user is your site’s disqus admin, this value should be consistent with Disqus Admin – Settings – Community – Moderator Badge Text.

0x02 Credit

The core javascript library I use is DisqusJs by Sukka.

The plugin framework is copy and pasted from pipDisqus by pipdig.

About the author

EDLinus

[stay(d) for d in ('determined','diligent','devoted')]

 
By EDLinus
Coding, Web, Hydrology and more.

Meta