How To Add Disqus Recent Comments Widget


In the last post, I told the way to implement Disqus Combination widget to your web site which have recent comments, popular threads and commented users, all in one. But, if you only need one of it, why load all 3 of them. So, if you only want the Recent Comments widget, you will find this post useful.

Screenshot

Disqus Recent Comments Widget

Disqus Recent Comments Widget

You can also see a demo on JsFiddle.

The Code

Insert the following code in the place where you want to display the widget :

<div id="RecentComments" class="dsq-widget">
 <h2>Recent Comments</h2>
 <script type="text/javascript" src="https://example.disqus.com/recent_comments_widget.js?num_items=5&hide_mods=0&hide_avatars=0&avatar_size=32&excerpt_length=100"></script>
</div>

You should replace the “example.disqus.com” with your Disqus forum URL ( “shortname.disqus.com” ).

Configure

As I said in my previous post, this widget also supports configuration like the “Combination Widget”.

Name Default Value Description
num_items 5 The number of items that should be shown (includes all items).
hide_mods Set To “1” to hide Moderators’ comments
excerpt_length 100 The excerpt (short version of comment) length
hide_avatars Set to “1” if you don’t want to display avatars
avatar_size 32 The Size of the avatar of user.

You can add this code in Blogger, WordPress and any other Blogging services.

Blogger

Go to your Blogger Blog -> Layout and click on the “Add a Gadget” button. Choose “HTML/JavaScript” widget :

Add HTML/Javascript Widget In Blogger

Add HTML/Javascript Widget In Blogger

Then, paste the code and click “Save” button.