Working the Net

Featuring the continuing adventures of Dirk Hoag: a husband, father, ERP IT director (Infor M3) and ex-hockey blogger.

  • Adventures in ERP
  • Blogging Tips
  • Book Reviews
  • How to Twitter
  • About

[footer_backtotop]

Email: DIRKHOAG on the GMAIL · Copyright © 2025 - All rights reserved.

How To Add a Disqus Recent Comments Widget in WordPress

Disqus is a tremendous tool for handling the comments on your Wordpress website or blog, but the one thing I’ve been missing is a good way to display Recent Comments on the sidebar.

My latest project, the Nashville Sports Hub, is starting to spark some decent conversations, and I’d like to be able to feature that in the sidebar. Unfortunately, the standard WordPress Recent Comments widget doesn’t work especially well with Disqus. It also turns out that Disqus doesn’t offer widgets straight from their website, but the functionality is out there if you know how to tap into it.

Upon doing a search I found one site which laid out the steps for creating a recent comments widget on the Blogger platform, but what about WordPress?

Creating a Disqus Recent Comments Widget in WordPress

It turns out that the idea is basically the same, thankfully. You’ll need to drop in and modify some Javascript code, but don’t worry! If you’re not a programmer at all, this is still super-easy, and by the time you’re done, you’ll be on your way to full-fledged Geekhood.

Step 1: Get your site’s Disqus ID

You’re going to need your Disqus Site ID later on, so log into Disqus and click the “Dashboard” link. On the left side, under the “Your Sites” heading, you’ll see all the sites for which you are the administrator, and next to the Site Name, the Site ID will be in parantheses, like this:

create disqus recent comments widget step 1
The Disqus Site ID in this example is nashvillesportshub.
Step 2: Create a Text widget with script calling Disqus

Log into your WordPress dashboard, and head to the Widgets section. Drag a Text widget into the sidebar (or other area) where you would like to place it, and copy the following text into it:

<div id=”recentcomments”><script type=”text/javascript” src=”http://YOURSITEID.disqus.com/recent_comments_widget.js?num_items=3&hide_avatars=0&avatar_size=32&excerpt_length=100“></script></div>

Step 3: Customize the script for your site and preferences

Now it’s time to tweak that code to work for your site, taking those bits I’ve highlighted in red one at a time:

  • Change the YOURSITEID to whatever the site ID is that you’re working with. Mine, for example, was “nashvillesportshub”.
  • Set how many comments you’d like to appear by changing the number after “num_items=” in the text above. In this case, I’m using 3, but 5 is also commonly used.
  • Do you want people’s Disqus avatars to appear, or stick with just text? To show the avatars, leave the number after “hide_avatars=” at 0, otherwise change it to 1 to show text only.
  • How big should those avatars be? You may want to change the size based on the site format you’re working with, but try leaving “avatar_size=” to 32 first to see how that looks.
  • How much text from each comment do you want to show? I like to show just enough to entice readers to click through and read more, so I have “excerpt_length=” set to 100 characters.

Feel free to twist the dials on those variables and see what works best for your site. If you have an active commenting community, you may want to show more recent comments, while those less actives ones may be best off displaying fewer (it may not look good to show something a month old, but you’re calling it “recent”).

So give this a shot on your own WordPress site, and make sure to swing by the Nashville Sports Hub and join the conversation!

Related articles
  • Who Writes the Most Popular Content on Your Blog?
  • HOW TO Embed Tumblr Blog on Self Hosted WordPress Site
  • 15 Useful, Little-Known WordPress Plugins to Add to Your Collection | RYP Marketing
Enhanced by Zemanta

Filed Under: SEO, Blogging & Social Media Tagged With: Blogging, Disqus, javascript, widget, WordpressLast updated: April 28, 2016

Comments

  1. Oliver Bien says

    December 21, 2012 at 9:06 am

    Awesome, works like a charm. Tho copying the code from this site destroys the code since different quotations are used 😉 Do you know by any chance how to translate the widget? I am running a german blog and it shows all the details in english, like when the comment was posted…

    Reply
    • Dirk Hoag says

      December 21, 2012 at 9:29 am

      That’s a great question, Oliver. Have you set your site’s language in the Disqus administration screen? I would think that if Disqus knows that your site is in German, it would respond to this Javascript with German output.

      http://help.disqus.com/customer/portal/articles/466219-what-languages-does-disqus-support-

      Viel Glück!

      Reply
      • Oliver Bien says

        December 21, 2012 at 9:46 am

        Thanks for the quick reply. Yes, I already changed that language setting. Seems like it doesnt apply for the widget’s JS code. Support probably has been discontinued since the widget options disappeared from the sites options but there’s still hope for a wordpress included widget system soon. Thanks for you help! 🙂

        Reply
  2. health insurance says

    December 23, 2012 at 6:48 am

    Informative post. I also use disqus for blog commenting.

    Reply
  3. Dirk Hoag says

    December 23, 2012 at 8:46 am

    That’s interesting, I wonder if the additional class parameter at the beginning of your code is required by the CSS on your particular site. Glad it worked out for you, though!

    Reply
    • eklwebadmin says

      September 18, 2013 at 11:19 am

      JacySFN’s link is correct. Also, I removed the “class” tag and it had absolutely no effect. The code from github is superior.

      Reply
  4. David Brewer says

    December 25, 2012 at 1:14 am

    Thanks for posting this Dirk. I had to use the tweak suggested by JacySFN below to get mine working, but I wouldn’t have found that without your initial post so thanks. David

    Reply
  5. health insurance says

    December 27, 2012 at 11:12 pm

    Good news. I feel this is powerful comment system for wordpress, in my opinion.

    Reply
  6. Jeremy Myers says

    February 6, 2013 at 8:30 pm

    Thanks for the link to the other code. For some reason that one worked for me too!

    Reply
  7. Rowan Gonzalez says

    March 5, 2013 at 3:40 am

    Thanks for the info 🙂 Going to try this out.

    Reply
  8. Hardeep Asrani says

    March 9, 2013 at 12:34 am

    Thanks for giving my site a backlink in this post… 🙂

    Reply
  9. JR Williams says

    March 12, 2013 at 2:25 pm

    great tutorial… again the quotation marks within the code would have to be retyped in notepad prior to pasting the full code into the text field widget.

    Reply
  10. lbobach says

    March 23, 2013 at 3:46 am

    Thank you very much for the tutorial, Works great. Do you know how I could hide my own comments? I do not want them to show up in the widget…

    Reply
    • 40uno Webworkers says

      May 11, 2013 at 9:11 am

      Hi Lars, i don’t know you get it right now, but if not you need this in the script line: &hide_mods=1

      Reply
  11. Online Strategies says

    March 26, 2013 at 10:41 pm

    Thanks for sharing information on Recent comment widget. I was actually looking one for my blog and I find your instructions are very easy to follow.

    Reply
  12. dinodev says

    April 9, 2013 at 2:14 am

    How do I show the Comment images in the recent images? Like the one i attached below?

    Reply
  13. mlmleadsgenerationblog says

    April 13, 2013 at 5:14 am

    Hi, does anyone know how to add some css to this? The avatar is just slightly off-kilter

    Reply
  14. Y8 Games says

    April 27, 2013 at 5:13 am

    i like disqus because it help me don’t need creat acc to comment blog.
    thanks for post

    Reply
  15. icodery says

    May 28, 2013 at 8:48 am

    Thanks for the info ^.^

    Reply
  16. WordPress Developer says

    September 5, 2013 at 7:24 am

    Great article …….. I’ll definitely try it in my WordPress project.
    Thanks for Sharing
    Expert Village Media

    Reply
  17. martiin says

    November 2, 2013 at 7:07 pm

    Wow that’s cool, because I developed dynamic sidebar for wordpress, here moore info how it works http://www.jb-webs.com/dynamic-wordpress-sidebar/ and installed the disqus plugin today. So first thing I did was to check that and yes, you right – there is no widget – so second thing I will do now is to study carefully your tutorial, because seems me a must have too load that as well in the sidebar – thanks foor that

    Reply
  18. y8 says

    November 18, 2013 at 3:51 am

    ye cac em nguc to

    Reply
  19. Virtual Underground says

    October 22, 2015 at 6:23 am

    its not gonna work

    Reply
  20. Risorseweb says

    January 5, 2016 at 3:08 am

    Hello! How to set the generated links in rel=”external nofollow”? Is it possible?

    Reply
  21. Renan Rollo says

    April 28, 2016 at 12:31 pm

    Thanks man!!! this link worked perfectly in my text widget area!

    Reply
    • Dirk Hoag says

      April 29, 2016 at 10:19 am

      I’m glad that helped!

      Reply
  22. Gaucho says

    January 11, 2018 at 5:17 pm

    good post! many thanks!

    Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Recent Posts

Zigging While Others Are Zagging: My Sports Blogging Story

Bookmarks On Twitter: Finally!

Infor M3 Customer Order API Processing Tips

StreamServe Help: The Mysterious Multi-Page Invoice

infor m3 consultant erp

Infor M3 Consultant: The Gig-Based Model