How To Add Disqus Recent Comments Widget


Read {count} times since 2020

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”.

<td>
  Default Value
</td>

<td>
  Description
</td>
<td>
  5
</td>

<td>
  The number of items that should be shown (includes all items).
</td>
<td>
</td>

<td>
  Set To "1" to hide Moderators&#8217; comments
</td>
<td>
  100
</td>

<td>
  The excerpt (short version of comment) length
</td>
<td>
</td>

<td>
  Set to "1" if you don&#8217;t want to display avatars
</td>
<td>
  32
</td>

<td>
  The Size of the avatar of user.
</td>
Name
num_items
hide_mods
excerpt_length
hide_avatars
avatar_size

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.