Whitespace WordPress Theme and Right Column Moving Under Content Area
On some posts I noticed that the contents of the right column would appear under the content (the middle column). Horrid!
Looking at the CSS of the page as rendered on Firefox and with Web Developer extension – which I don’t know much about and don’t use much – showed that it was there because it was seen as content and not a new div. Old hands will have known this all the time I’m sure. So somehow the Content area was not being closed off as it should.
More poking around and I found the problem was repeatable:
- If commenting (in posts) was switched on then this did not happen.
- If there were no comments and commenting is closed then no problem.
- If there are comments and commenting is then closed then there was a problem
The problem turned out to be a lack of a closing </div> in those circumstances – the logic was flawed.
To fix, go into comments.php
Find this code (note I have collapsed spaces from the start of lines):
<?php else : // this is displayed if there are no comments so far ?>
<?php if ('open' == $post->comment_status) : ?>
<!-- If comments are open, but there are no comments. -->
<?php else : // comments are closed ?>
<!-- If comments are closed. -->
<p>Comments are closed.</p></div>
<?php endif; ?>
<?php endif; ?>
and remove the bold </div> to give this:
<?php else : // this is displayed if there are no comments so far ?>
<?php if ('open' == $post->comment_status) : ?>
<!-- If comments are open, but there are no comments. -->
<?php else : // comments are closed ?>
<!-- If comments are closed. -->
<p>Comments are closed.</p>
<?php endif; ?>
<?php endif; ?>
Also towards the bottom of the file find this
<?php do_action(‘comment_form’, $post->ID); ?>
</form>
</div>
and remove the bold </div> to give this:
<?php do_action(‘comment_form’, $post->ID); ?>
</form>
And the last change is to add a </div> as the very last line in the file, which should then look like this:
<?php endif; // if you delete this the sky will fall on your head ?>
</div>
comments
Leave a Reply