WordPress.org

Ready to get started?Download WordPress

Forums

Why aren't my comments showing? (4 posts)

  1. impontus
    Member
    Posted 6 years ago #

    Hi everyone.

    I'm working on a WordPress template and just ran across a very annoying problem, my comments won't show up (as you can see here: http://impontus.com/weblog/?p=1)

    This is what my comments.php looks like.

    <br clear="left" />
    
            <div id="container_comments">
    
                <?php if ( !empty($post->post_password) && $_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password) : ?>
    
                    <?php _e('Enter your password to view comments.'); ?>
    
                <?php return; endif; ?>
    
                <div id="responses>
    
                    <h4 class="responses"><?php comments_number(__('No Comments'), __('1 Comment'), __('% Comments')); ?></h4>
    
                </div>
    
                <?php foreach ($comments as $comment) : ?>
    
                <div id="comments">
    
                    <?php comment_text() ?>
    
                </div>
    
                <div id="comment_author">
    
                    <div id="align">
    
                        <h4 class="comment_author"><?php comment_author_link() ?></h4>
    
                        <p class="small"><?php comment_date() ?>
    
                    </div>
    
                </div>
    
                <br clear="left" />
    
                <?php endforeach; ?>
    
                <?php else : // If there are no comments yet ?>
    
    	            <?php _e('No comments yet.'); ?>
    
                <?php endif; ?>
    
                <?php if ( get_option('comment_registration') && !$user_ID ) : ?>
    
                    You must be <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?redirect_to=<?php the_permalink(); ?>">logged in</a> to post a comment.
    
                <?php else : ?>
    
                <br clear="left" />
    
                <div id="post_comment">
    
                    <form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">
    
                        <?php if ( $user_ID ) : ?>
    
                            Logged in as <a href="<?php echo get_option('siteurl'); ?>/wp-admin/profile.php"><?php echo $user_identity; ?></a>.
    
                        <?php else : ?>
    
                            <input type="text" name="author" id="author" value="<?php echo $comment_author; ?>" size="22" tabindex="1" />
                            <label for="author"><small>Name <?php if ($req) _e('(required)'); ?></small></label>
    
                            <input type="text" name="email" id="email" value="<?php echo $comment_author_email; ?>" size="22" tabindex="2" />
                            <label for="email"><small>Mail (will not be published) <?php if ($req) _e('(required)'); ?></small></label>
    
                            <input type="text" name="url" id="url" value="<?php echo $comment_author_url; ?>" size="22" tabindex="3" />
                            <label for="url"><small>Website</small></label>
    
                        <?php endif; ?>
    
                        <textarea name="comment" id="comment" cols="100%" rows="10" tabindex="4"></textarea>
    
                        <input name="submit" type="submit" id="submit" tabindex="5" value="Submit Comment" />
    
                        <input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" />
    
                        <?php do_action('comment_form', $post->ID); ?>
    
                    </form>
    
                    <?php endif; // If registration required and not logged in ?>
    
                    <?php else : // Comments are closed ?>
    
                        <?php _e('Sorry, the comment form is closed at this time.'); ?>
    
                    <?php endif; ?>
    
                </div>
    
            </div>

    Thanks.

  2. moshu
    Member
    Posted 6 years ago #

    And is there a call for the comments.php template in the single.php or index.php - whichever is used to display the single post?

  3. impontus
    Member
    Posted 6 years ago #

    Yes, in index.php there's a line like this:
    <?php comments_template(); // Get wp-comments.php template ?>

  4. impontus
    Member
    Posted 6 years ago #

    I did some changes in the code, and when I delete this part it works.

    <?php if ( $user_ID ) : ?>
    
                            Logged in as <a href="<?php echo get_option('siteurl'); ?>/wp-admin/profile.php"><?php echo $user_identity; ?></a>.
    
                        <?php else : ?>

    So I guess there's something wrong with that piece of code. Rihgt?

    This is what my comments.php looks like now:

    [moderated - don't post long code here; use http://wordpress.pastebin.ca

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags