Get a free trial // Grow your CSS skills // Land your dream job

problem with comments area

  • # January 22, 2009 at 10:51 am

    Im having a problem that I know is right under my nose but I just cannot figure it out. Im not sure if anyone can help me or not. It is once again on the site I have been building
    On my blog posts that DO NOT have comments.. there are div items that are not inside the wrapper and they are suppost to be in. It is ok on all other. I think I have figured out that is is something in the comment.php file where I need to ad or move a </div> end tag.. but I just cannot figure it out. Ive tried moving it all around, taking one out, adding more and it either messes other things up OR makes it so blog WITH comments have the same issue.

    basically my side bars, and footer get all messed up on these blog post single pages without comments.

    # January 22, 2009 at 11:27 am

    here is some additional information that is obviously a part of the problem. I have No idea how this is happening.

    when I view the page source for the single blog post page on the site that is messed up there is this.. (this is just a snippet towards the end where I see the issue.


    There are 2 end divs outside of the </body> and </html> that obviously shouldnt be there… I dont know how they go tthere.. when I go to my footer.php there is no such /divs outside of the </body></html> tags

    # January 22, 2009 at 11:34 am

    More observations..

    Ok. When I view the page source of my blog post with comments that has no isses, it also has those 2 </div> tags outside of </body></html> so maybe it is not directly related to the problem.

    when I view the page source of my home page or anything that isnt a single blog post page it does NOT have those 2 </div> tags.

    Also this is what happens. if I remove one of the </div> tags at the bottom of the code in the comments,php file the problem switches to blog posts WITH comments have the issue instead of Blog posts without comments. It alternates.

    it def seems to be comment related.

    Another thing I did last night and Im not sure if this problem is related or not because I dont know if I caught it. Last night I important blog posts from blogger… I wonder if it is related to that.

    # January 22, 2009 at 12:18 pm

    lin it would be better to see the actual code your using for wordpress, like the page.php &/or index.php whatever is being used.

    the source code only shows the html, we need to know where that html is being created.

    for example, you know your search bar, the main html is made in the searchform.php file, but it is called within say the index.php file

    but check your commentspopup.php does not have your footer & sidebar included

    # January 22, 2009 at 12:30 pm

    thats my problem I dunno where the actual problem is. I know when I mess around with the divs in the comments.php it changes the way things are messed up as I said but.. Ill look at the pages.php

    here is the code for my comments.php to look at.

    < ?php // Do not delete these lines if (!empty($_SERVER['SCRIPT_FILENAME']) && 'comments.php' == basename($_SERVER['SCRIPT_FILENAME'])) die ('Please do not load this page directly. Thanks!'); if (!empty($post->post_password)) { // if there’s a password
    if ($_COOKIE[‘wp-postpass_’ . COOKIEHASH] != $post->post_password) { // and it doesn’t match the cookie

    This post is password protected. Enter the password to view comments.

    < ?php return; } } /* This variable is for alternating comment background */ $oddcomment = 'class="alt" '; ?>

    < ?php if ($comments) : ?>

    < ?php comments_number('No Responses', 'One Response', '% Responses' );?> to “< ?php the_title(); ?>”

      < ?php foreach ($comments as $comment) : ?>

    1. id=”comment-< ?php comment_ID() ?>“>
      < ?php echo get_avatar( $comment, 32 ); ?>
      < ?php comment_author_link() ?> Says:
      < ?php if ($comment->comment_approved == ‘0’) : ?>

      Your comment is awaiting moderation.

      < ?php endif; ?>

      ” title=””>< ?php comment_date('M.j.Y') ?> at < ?php comment_time() ?> < ?php edit_comment_link('edit','  ',''); ?>

      < ?php comment_text() ?>

    2. < ?php /* Changes every other comment to a different class */ $oddcomment = ( empty( $oddcomment ) ) ? 'class="alt" ' : ''; ?>

      < ?php endforeach; /* end for each comment */ ?>

    < ?php else : // this is displayed if there are no comments so far ?>

    < ?php if ('open' == $post->comment_status) : ?>

    < ?php else : // comments are closed ?>

    Comments are closed.

    < ?php endif; ?>
    < ?php endif; ?>

    < ?php if ('open' == $post->comment_status) : ?>


    < ?php if ( get_option('comment_registration') && !$user_ID ) : ?>

    You must be /wp-login.php?redirect_to=< ?php echo urlencode(get_permalink()); ?>“>logged in to post a comment.

    < ?php else : ?>

    /wp-admin/profile.php”>< ?php echo $user_identity; ?>. /wp-login.php?action=logout” title=”Log out of this account”>Log out »

    < ?php else : ?>




    < ?php endif; ?>

    # January 22, 2009 at 12:39 pm

    does your index or page.php have footer or </body> / </html> tag

    these should be left in the footer.php

    so the code should look like (for say index.php) at the end:
    <?php get_sidebar(); ?>

    <?php get_footer(); ?>

    those 2 divs are inside your footer, by the looks of it

    or you have put your sidebar/footer.php inside divs

    EDIT: it seems fine now, did you do anaything?

    # January 22, 2009 at 1:28 pm

    I fixed it.. simple cut and paste new code from an untouched comments.php file.. added 3 </div> s toward the bottom and it did the trick. ?? dunno what I did before but I obviously messed something up bad.

    # January 22, 2009 at 1:29 pm
    "LinCSS25" wrote:
    I fixed it.. simple cut and paste new code from an untouched comments.php file.. added 3 </div> s toward the bottom and it did the trick. ?? dunno what I did before but I obviously messed something up bad.

    well done

Viewing 8 posts - 1 through 8 (of 8 total)

You must be logged in to reply to this topic.

There's a whole bunch of content on CSS-Tricks.

Search for Stuff   •   Browse the Archives

Get the Newsletter ... or get the RSS feed