Search code examples
javascriptwordpresscdatadisqus

Wordpress - Disqus error with custom page template


I created a custom page template to display a filterable portfolio in Wordpress. However, on that custom page I am getting an error code -

// <![CDATA[ (function() { document.write('<script charset="utf-8" type="text/javascript" src="http://thinquetanque.disqus.com/get_num_replies_from_wpid.js?v=2.2&amp;t=span&amp;wpid0=14&amp;wpid1=1"><' + '/script>'); })(); //]]> 

I think this might be because the page uses a loop to display posts. And Disqus is set to only display on posts.

See the page at: http://thinquetanque.com/portfolio

Any ideas on how to prevent this?

thanks!

EDIT: I found the spot in the code where this is happening - but I don't know how to resolve the error.

<script type="text/javascript">
// <![CDATA[
    (function() {
        document.write('<script charset="utf-8" type="text/javascript" src="<?php echo dsq_js_comment_count_url().$post_id_str; ?>"><' + '/script>');

    })();
//]]>
</script>

Solution

  • Apparently, when using theme frameworks - such as hybrid, or in my case, canvas - there is some sort of issue with the following bit of disqus code:

    add_action('loop_end', 'dsq_loop_end');
    
    function dsq_js_comment_count_url() {
        return 'http://'.strtolower(get_option('disqus_forum_url')).'.'.DISQUS_DOMAIN.'/get_num_replies_from_wpid.js?v=2.2&t=span'; }
    

    I removed it from disqus.php on line 726. and voila - problem solved.