Disqus Commenting

Disqus is an established platform making it an easy, convenient and simple way of adding a comments section to you blog, with features for filtering and comment management with a single sign-on feature that crosses thousands of sites it is highly usable for both the site visitor and modorator.

  1. Usage
  2. Comments

Usage


  • Create a Disqus account if you don't already have one and register your site setting > add Disqus to site.

  • Add the provided snippet to your site updating the required variables.

  • Create a Disqus container which has your page slug id.


Calling the plugin - Monstra shortcode and PHP calling code

This should be done either in the page content with the shortcode or via php in a page template.


{snippet get="disqus-comments"}

<?php echo Snippet::get("disqus-comments"); ?>
    

Disqus comments - Monstra snippet


<div id="disqus_thread"></div>
<script>
    /**
     *  RECOMMENDED CONFIGURATION VARIABLES: EDIT AND UNCOMMENT THE SECTION BELOW TO INSERT DYNAMIC VALUES FROM YOUR PLATFORM OR CMS.
     *  LEARN WHY DEFINING THESE VARIABLES IS IMPORTANT: https://disqus.com/admin/universalcode/#configuration-variables
     */    
    var disqus_config = function () {
        this.page.url = '<?php echo Site::url(); ?>/blog/<?php echo Page::slug(); ?>';  // Replace PAGE_URL with your page's canonical URL variable
        this.page.identifier = '<?php echo Page::slug(); ?>'; // Replace PAGE_IDENTIFIER with your page's unique identifier variable
    };
    
    (function() {  // DON'T EDIT BELOW THIS LINE
        var d = document, s = d.createElement('script');
        
        s.src = '//EXAMPLE.disqus.com/embed.js';
        
        s.setAttribute('data-timestamp', +new Date());
        (d.head || d.body).appendChild(s);
    })();
</script>
<noscript>Please enable JavaScript to view the <a href="https://disqus.com/?ref_noscript" rel="nofollow">comments powered by Disqus.</a></noscript>

<script id="dsq-count-scr" src="//EXAMPLE.disqus.com/count.js" async></script>
        


Variable Details
EXAMPLE.disqus.com Ensure that you update the snippet to reference your Disqus URL
On Lines 15 & 23

Disqus comment count - inline code

Using the snippet detailed above yo are able to extract the number of comments posted with Disqus for use in the blog post and update the Disqus container.



<span class="disqus-comment-count" data-disqus-identifier="{page_slug}"></span>
    

Comments