Running on a new WP theme

I have fallen for the recommendations, and bought and installed the Headway Theme

Finally, got it working too. It is easy, everything is a snap, except when you have want to make some really “fancy” thing on your site – like the Video Posts on the right -, then it’s php coding. Or when it chokes on plugins, like on Disqus. Don’t know why, but it simply could not handle it.

I wonder what can cause this behaviour, as people say they are running it without trouble – I am well prepared now for the flaming I’m going to get for pointing out problems :) – but below you can see the problem in all it’s glory.

The tricky thing is what I have discovered is that it only happens in the Featured leaf, and then only when I set it to Rotate the posts.

The solution for now was pure hacking. The Disqus code that seems to be the cuplrit – or the victim, depends on how you look at it – can be found in the disqus.php:


function dsq_comment_count() {
  global $dsq_cc_script_embedded;
  if ( $dsq_cc_script_embedded ) {
    return;
  } else if ( (is_single() || is_page() || $withcomments || is_feed()) ) {
    return;
  }
  ?>
  <script type="text/javascript">
  // <![CDATA[
   (function() {
     var links = document.getElementsByTagName('a');
     var query = '&';
     for(var i = 0; i < links.length; i++) {
       if(links[i].href.indexOf('#disqus_thread') >= 0) {
       links[i].innerHTML = 'View Comments';
       query += 'wpid' + i + '=' + encodeURIComponent(links[i].getAttribute('wpid')) + '&';
     }
   }
   document.write('<script charset="utf-8" type="text/javascript" src="<?php echo DISQUS_URL ?>/forums/<?php echo strtolower(get_option('disqus_forum_url')); ?>/get_num_replies_from_wpid.js?v=2.0' + query + '"><' + '/script>');
 })();
 //]]>
 </script>
 <?php
   $dsq_cc_script_embedded = true;
}

This only happened in the Featured Post leaf, and only when I enabled Rotate – maybe the rotate script and the Disqus script get tangled. I don’t know.

For now what I have done is pure, and serious no-no hacking. I have commented out the code between <script type="text/javascript">// <![CDATA[ and // ]]></script>.
Evidently it is the wrong solution, but for now it works, and I am going to find out the proper one.

UPDATE: After a bit of thinking I have decided to instead implement a more cultured temporary solution.
I have changed this line:

} else if ( (is_single() || is_page() || $withcomments || is_feed()) ) {

to this line:

} else if ( (is_home() || is_single() || is_page() || $withcomments || is_feed()) ) {

Yes, I know that was the logical thing from the start.

&gt;
Reblog this post [with Zemanta]

This website uses IntenseDebate comments, but they are not currently loaded because either your browser doesn't support JavaScript, or they didn't load fast enough.

One Response to Running on a new WP theme
  1. KarenSwim
    August 25, 2009 | 22:49

    Roland, I'm sure that the theme developers will appreciate the honest feedback. I have heard that others were having Disqus problems lately too so maybe that is an isolated issue. I have created several client blogs on Thesis and was considering trying Headway on one of my own blogs. I appreciate your honesty and think for now I'll stick with what I know works.

Leave a Reply


Wanting to leave an <em>phasis on your comment?

Trackback URL http://fracturedbloughts.rolandhesz.com/2009/08/24/running-on-a-new-wp-theme/trackback/