WordPress : Lazy Load Disqus Comments on Button Click

Over the last few days, I have made some changes on the site to improve its speed. One of such changes was replacing the native WordPress comment system with Disqus. I changed the comment system because I thought of doing something like what Amit Agarwal has done on Labnol - make comments appear only when the visitors click on a button. This will reduce a lot of HTTP requests and in turn, help to improve site speed. I googled and then came across a post that did exactly what I was looking for!

NOTE : I have noticed that doing this will create a problem with Comment Sync, meaning, if you ever choose to leave Disqus and switch to the native WordPress comment system, all the comments might not be imported to the native WP comment system.

What we are trying to accomplish here is to load comments only when a button at the end of the page is clicked. If a visitor is really interested to leave a comment, he will do so by clicking a button. This guide is meant for WordPress, although  the same code can be used on other platforms as well.

On WordPress, go to Plugins > Editor. Select Disqus Comment System. On the right pane, click on disqus-comment-system/comments.php. (Make a backup of the file  by copying all the texts there to a text editor.) Now, replace all the texts with the one below :

<div id="comments" class="comments-area">

<div class="showDisqus">
<center><input type="submit" value="Load All Comments and Add Yours." /></center>
</div>

<div id="disqus_thread"></div>
</div>

<script type="text/javascript">
 $j=jQuery.noConflict();
 $j(document).ready(function() {
 $j('.showDisqus').on('click', function(){   // click event of the show comments button
 var disqus_shortname = 'thelacunablog';  // Enter your disqus short
 // ajax request to load the disqus javascript
 $j.ajax({
 type: "GET",
 url: "http://" + disqus_shortname + ".disqus.com/embed.js",
 dataType: "script",
 cache: true
 });
 $j(this).fadeOut();  // remove the show comments button
 });
 });
</script>

<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>

read more

5 Sites To Get Freebies

If you are a regular reader here, you might have wondered at times how I learn about different freebie offers. There is a separate section here that deals with freebies and I have been posting some giveaways every once in a while. As every other blog post, freebies also require a bit of research. But, unlike other posts, you can find those deals listed on a fixed set of sites. Here I will make a list of sites that I have been using in order to get free stuff for you guys. These sites, or forums to be more exact, are the places where users share the free deals that they have come across.

read more

How To Verify Nepali PayPal With Payoneer MasterCard?

PayPal, the most popular online payment processor, can be used by Nepalese but only for the purpose of sending money. A Nepali PayPal account cannot be used to receive money. We had talked about creating a PayPal of another country and withdrawing the money in Nepal earlier . On this post, however, we're going to explain to you how you can verify a Nepali PayPal account which can only be used to send payments.

read more

How To Export Google Sites Posts To WordPress

Google Sites is an easy site builder provided by Google. However, the number of people who use Google Sites, or even know that it exists, is very less since most of the users prefer to go with Blogger or WordPress.  You don't need to have any technical knowledge to use Google Sites, not even the amount you require to operate a Blogger blog. It is very simple and has a very limited number of options.

read more

How To Change Non-English Version Of Kapsersky AV To English?

We had covered a giveaway of Kaspersky Antivirus 2013 organized by Kaspersky China. The licence key could only be used on a Simplified Chinese version of Kaspersky AV 2013. So, I had suggested a method to disable the self defense and press Shift + F12 in order to change the language to English. But, that method worked temporarily and each time you re-started your computer, you had to press Shift + F12 to change the interface language.

read more