• My blog: https://livinginsmallsizes.com.

    I redid the theme and am having an issue with comments. If there are already comments then users can submit more. However for posts that have no comments, the comment submit form is not being displayed.

    Any help appreciated.

    My comments.php:
    <!-- Begin Comments.php -->

    <?php if ( !empty($post->post_password) && $_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password) : ?>
    <p><?php _e('Enter your password to view comments.'); ?></p>
    <?php return; endif; ?>

    <?php if ($comments) : ?>

    <?php

    /* This is a loop for printing pingbacks/trackbacks if there are any */
    if ($numPingBacks != 0) : ?>

    <h2 class="comments-header"><?php _e($numPingBacks); ?> Trackbacks/Pingbacks</h2>
    <ol id="trackbacks">

    <?php foreach ($comments as $comment) : ?>
    <?php if (get_comment_type()!="comment") : ?>

    <li id="comment-<?php comment_ID() ?>" class="<?php _e($thiscomment); ?>">
    <?php comment_type(__('Comment'), __('Trackback'), __('Pingback')); ?>:
    <?php comment_author_link(); ?> on <?php comment_date(); ?>

    <?php if('odd'==$thiscomment) { $thiscomment = 'even'; } else { $thiscomment = 'odd'; } ?>

    <?php endif; endforeach; ?>

    <?php endif; ?>

    <?php if ( $comments ) : ?>

    <?php /*track comment number*/ $commentNumber = 0; ?>
    <?php foreach ($comments as $comment) : ?>
    <div id="comment-<?php comment_ID() ?>"
    <?php /*highlight comments from author*/ if ($comment->user_id == '1') echo ' class="commentspecial"'; else echo ' class="comment"'; ?> >
    <div class="commentbody">
    <div class="commentauthor"><?php comment_author_link() ?> writes:</div>
    <?php comment_text() ?>
    </div>
    <div class="commentmeta">
    <div class="commentdate">
    <cite><?php comment_date() ?> @ "><?php comment_time() ?></cite> <?php edit_comment_link(__("Edit This"), ' | '); ?>
    </div>
    <div class="commentnumber"><?php $commentNumber++; echo $commentNumber; ?></div>
    </div>
    </div>

    <?php endforeach; ?>

    <?php else : // If there are no comments yet ?>
    <p><?php _e('No comments yet.'); ?></p>
    <?php endif; ?>

    <p>
    <?php comments_rss_link(__('RSS feed for comments on this post.')); ?>
    <?php if ( pings_open() ) : ?>
    " rel="trackback"><?php _e('TrackBack URI'); ?>
    <?php endif; ?>
    </p>

    <?php if ( comments_open() ) : ?>
    <div id="commenttools">
    <p>Leave a comment</p>
    <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; ?>
    .
    /wp-login.php?action=logout"
    title="Log out of this account">Logout

    </p>

    <?php else : ?>

    <p><input type="text" name="author" id="author" value="<?php echo $comment_author; ?>" size="22" />
    <label for="author">Name<?php if ($req) _e(' (required)'); ?></label></p>

    <p><input type="text" name="email" id="email" value="<?php echo $comment_author_email; ?>" size="22" />
    <label for="email">E-mail (will not be published)<?php if ($req) _e(' (required)'); ?></label></p>

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

    <?php endif; ?>

    <?php /* You might want to display this:
    <p>XHTML: You can use these tags: <?php echo allowed_tags(); ?></p> */ ?>

    <p><textarea name="comment" id="comment" rows="10" cols="60"></textarea></p>

    <?php /* Buttons are easier to style than input[type=submit],
    but you can replace:
    <button type="submit" name="submit" id="sub">Submit</button>
    with:
    <input type="submit" name="submit" id="sub" value="Submit" />
    if you like */
    ?>
    <p><button type="submit" name="submit" id="sub">Submit</button>
    <input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>"/></p>

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

    </form>

    </div>

    <?php else : // Comments are closed ?>
    <p id="comments-closed">Sorry, comments for this entry are closed at this time.</p>
    <?php endif; ?>

    <? endif; ?>

  • The topic ‘Comment Entry Form not showing’ is closed to new replies.