The Disqus filter is incredibly easy to get set up on your blog but it doesn't seem to provide a wrapper method for you to add your extra mark-up. This tutorial teaches you how to integrate it into your Roots-based theme.
Installing and setting up the disqus theme cleanly and succinctly takes over your vanilla flavour WordPress comments system but then I was left with a rather basic transition from end of post to comments section.
(If you haven't installed Disqus on your blog yet then you are way, way off in the wrong location right now. Visit http://www.disqus.com/ and the setup process is detailed their very clearly).
content-single.php file in
./templates/ folder of your Roots theme has a call to the normal WordPress comments:
<?php comments_template('/templates/comments.php'); ?>
Normally you would be able to edit this file and change the html markup to provide your snazzy marketing phrases that engage the audience. When Disqus takes over however it adds a filter which basically wipes out the content generated in your
comments_template() call and replaces it with its own.
I wanted to at least add a header to split if off but a container that I could style and an intro paragraph wouldn't hurt either.
After digging around for some kind of wrapper filter that I could use to override Disqus' override I eventually fell back to this solution:
<?php if (comments_open()) : ?> <aside class="commentswrapper"> <h3>Comments</h3> <p>Make all the comments!</p> <?php comments_template('/templates/comments.php'); ?> </aside> <?php endif; ?>
It checks if this post supports comments and then wraps the
comments_template() call which Disqus then trashes anyway, but they don't get their hands on your modifications.
comments_open() check is normally done in the
comments.php but this way when your comments are disabled (which can be done by the user) you don't end up with a block something like:
Header Intro text (complete lack of Disqus)