Sidebar drops down when no comments
-
I’m a freelance designer now learning wordpress by building a custom theme. My site is located at http://www.crankybeardesign.com/wordpress/blog.
The problem I’m having is that when viewing an individual post page with no comments, the sidebar drops down to the bottom, and the footer occupies the space where the sidebar should be.
You can see the problem here: http://crankybeardesign.com/wordpress/blog/2009/02/17/pavlovs-man/
A post page with comments (and without the problem) is here: http://crankybeardesign.com/wordpress/blog/2009/02/07/new-post/I can’t figure this out for the life of me. I’ve pored over my code, and over the web to try to find a parallel problem.
Thanks in advance for your help!
-
Nevermind, I’ve got it. For any other poor bastard out there having a similar problem, here’s what happened.
I had added a styling div in the comments.php file. Since I don’t know php, I didn’t realize that closing the div at the bottom of the page only closed the div when one of the possible cases was true (i.e. there were comments). Adding close div tags to the other possible cases, as below, solved the issue:
<?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. –> <p><b><?php comments_number('No comments yet', 'One comment', '% comments' );?> on “<?php the_title(); ?>”</b></p> </div> <?php else : // comments are closed ?> <!– If comments are closed. –> <p><b>Comments are not allowed on “<?php the_title(); ?>”</b></p> </div> <?php endif; ?> <?php endif; ?>I was really tearing out my hair for about an hour there…
I have the same problem and I really thought this would work, but unfortunately it didn’t.
I had the same problem with the default design. By this i mean that when i click on a post, to make some comment, the sidebar doesn’t appear.
Here is what i’ve done to make it more user friendly (showing the sidebar). Please note that this works for the default design.
1/ make the sidebar appear
in your admin menu / appearance / editor, select your template (default) and then single post (single.php).At the bottom of this file, just before this line :
<?php get_footer(); ?>
add this one :<?php get_sidebar(); ?>2/ now you have to make your design on two columns :
on the same file but at the top you’ll find this line :<div id="content" class="widecolumn" role="main">replace it by this one :
<div id="content" class="narrowcolumn" role="main">hope it will help.
The topic ‘Sidebar drops down when no comments’ is closed to new replies.