WordPress.org

Forums

sidebar funky on single.php due to comment.php (1 post)

  1. wardrobe911
    Member
    Posted 6 years ago #

    I have been trying to figure this out and can't for the life of me uncover the problem. I have a feeling it's a really easy fix but I don't know enough css + php to see it.

    Issue: The sidebar formatting turns off when you click to read a full blog post. For example the h2 and h3 formats no longer apply. The blog's home and archive pages are good but the single post page is not.

    I am almost 90% sure it has something to do with the comments.php file (A while back i fixed the file to highlight the author's comments and that's when this error appeared.) Now 5 months later, I'm trying to resolve it. I am pretty limited with my knowledge on my css and php -- I honestly surprise myself that I was able to tweak my theme at all. ha.

    Here is what's in the comment.php file:

    <?php
    /**
    * @package WordPress
    * @subpackage Default_Theme
    */

    // 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 ( post_password_required() ) { ?>
    <p class="nocomments">This post is password protected. Enter the password to view comments.</p>
    <?php
    return;
    }
    /* This variable is for alternating comment background */
    $oddcomment = 'alt';
    ?>

    <?php
    global $bm_comments;
    global $bm_trackbacks;

    split_comments( $comments );
    ?>

    <!-- You can start editing here. -->
    <!-- comment id field added right below -->
    <?php comment_id_fields(); ?>

    <?php if ( have_comments() ) : ?>
    <h2 class="commh2"><?php comments_number('No Responses', 'One Response', '% Responses' );?> To This Post</h2>

    <div class="navigation">
    <div class="alignleft"><?php previous_comments_link() ?></div>
    <div class="alignright"><?php next_comments_link() ?></div>
    </div>

    <ol class="commentlist">
    <?php wp_list_comments(); ?>

    <?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 class="nocomments">Comments are closed.</p>

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

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

    <div id="respond">
    <p></p>

    <h2><?php comment_form_title( 'Leave a Reply', 'Leave a Reply to %s' ); ?></h2>
    </div>

    <div class="cancel-comment-reply">
    <small><?php cancel_comment_reply_link(); ?></small>
    </div>

    <?php if ( get_option('comment_registration') && !$user_ID ) : ?>
    <p>You must be /wp-login.php?redirect_to=<?php echo urlencode(get_permalink()); ?>">logged in to post a comment.</p>
    <?php else : ?>

    <form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">

    <?php if ( $user_ID ) : ?>

    <p>Logged in as /wp-admin/profile.php"><?php echo $user_identity; ?>. " title="Log out of this account">Log out »</p>

    <?php else : ?>

    <p><input type="text" name="author" id="author" value="<?php echo $comment_author; ?>" size="22" tabindex="1" <?php if ($req) echo "aria-required='true'"; ?> />
    <label for="author"><small class="commentmetadata">Name <?php if ($req) echo "(required)"; ?></small></label></p>

    <p><input type="text" name="email" id="email" value="<?php echo $comment_author_email; ?>" size="22" tabindex="2" <?php if ($req) echo "aria-required='true'"; ?> />
    <label for="email"><small>Mail (will not be published) <?php if ($req) echo "(required)"; ?></small></label></p>

    <p><input type="text" name="url" id="url" value="<?php echo $comment_author_url; ?>" size="22" tabindex="3" />
    <label for="url"><small>Website</small></label></p>

    <?php endif; ?>

    <!--<p><small>XHTML: You can use these tags: <?php echo allowed_tags(); ?></small></p>-->

    <p style="padding:10px 0px 10px 0px;"><textarea name="comment" id="comment" style="width:99%;" rows="10" tabindex="4"></textarea></p>

    <?php include(TEMPLATEPATH . '/includes/stylesheet.php'); ?>
    <p style="padding:10px 0px 10px 0px;"><input name="submit" type="image" src="<?php bloginfo('stylesheet_directory'); ?>/styles/<?php echo "$style_path"; ?>/btn-submit.gif" id="submit" tabindex="5" value="Submit Comment" />
    <input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" />
    </p>

    <?php do_action('comment_form', $post->ID); ?>

    </form>

    <?php endif; // If registration required and not logged in ?>
    </div>
    <div class="fix"/></div>

    <?php endif; // if you delete this the sky will fall on your head ?>

    Here's the comment css (i had to add all this to get the comments to look right -- former theme didn't have it):

    /*========= COMMENTS =========*/
    h2.commh2 {
    font-size: 1.4em !important;
    padding: 0 0 5px;
    color: #333 !important;
    border-top: 1px solid #cacaca;
    padding-top: 13px;
    }

    li.bypostauthor {
    background-color: #E5EFEE;
    border: 1px solid #cacaca;
    }

    ol.commentlist {
    margin-top: 15px;
    padding: 0;
    list-style: none;
    font-size: 12px;
    line-height: 12px;
    }

    ol.commentlist p {
    margin-bottom: 10px;
    line-height: 12px;

    }

    ol.commentlist cite {
    font-style: normal;
    font-weight: bold;
    margin-bottom: 15px;
    }

    ol.commentlist li {
    padding: 20px 10px 10px 10px;
    }

    .commentlist li, #commentform input, #commentform textarea {
    font: 12px 'Verdana', Arial, Sans-Serif;
    border-bottom: 1px solid #cacaca;
    }

    .commentlist li ul li {
    font-size: 12px;
    }

    .commentlist li {
    font-weight: bold;
    }

    .commentlist li .avatar {
    float: left;
    border: 1px solid #eee;
    padding: 1px;
    background: #fff;
    margin-right: 12px;
    }

    .commentlist cite, .commentlist cite a{
    font-weight: bold;
    font-style: normal;
    font-size: 1.1em;
    }

    .commentlist p {
    font-weight: normal;
    line-height: 1.1em;
    text-transform: none;
    margin-top: 12px;
    }

    #commentform p {
    font-family: 'Verdana', Arial, Sans-Serif;
    }

    .commentmetadata {
    font-weight: normal;
    }

    commentbutton {
    background: url(/wp-content/themes/flashnews/flashnews/styles/default/btn-submit.gif) no-repeat;
    }

    input#submit {
    border: 0px;
    }

    Thanks to anyone who can provide some guidance!

Topic Closed

This topic has been closed to new replies.

About this Topic