• I’ve just started using wordpress and I thought I’d try my hand at making a theme for my blog. Everything is working fine except the comments. I tested the theme on my personal webserver and it worked but when I uploaded it to my site, the comments are not showing up. It just stays as “There are no comments currently.” SEE HERE. I suspect it might have something to do with the mod-rewrite permalinks (since I had a similar problem with the default wordpress theme which was later resolved by changing the permalink options around). Anyway, if someone can, please help me :/! Your aid is appreciated!
    Here’s the code for comments.php:

    <?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 ( post_password_required() ) { ?>
    		<h5>Comments</h5>
    		<div class="comments">This post is password protected. Enter the password to view comments.</p>
    	<?php
    		return;
    	}
    ?>
    
    		<div id="comments">
    		<h5>Comments</h5>
    <?php if ($comments) : ?>
    <?php foreach ($comments as $comment) : ?>
    
    			<div  class="comment" id="comment-<?php comment_ID() ?>">
    			<?php comment_text() ?>
    			</div>
    			<h4>by <?php comment_author_link() ?> @ <a href="#comment-<?php comment_ID() ?>" title=""><?php comment_date('d M Y, h:i a') ?></a> <?php edit_comment_link('Edit Comment','',''); ?></h4>
    <?php if ($comment->comment_approved == '0') : ?>
    			<em><?php _e('Your comment is awaiting moderation.'); ?></em>
    <?php endif; ?>
    <?php endforeach; /* end for each comment */ ?>
    <?php else : // this is displayed if there are no comments so far ?>
    <?php if ('open' == $post->comment_status) : ?>
    		<div class="comment">There are currently no comments.</div>
    <?php else : // comments are closed ?>
    		<div class="comment">Comments are closed.</div>
    <?php endif; ?>
    <?php endif; ?>
    
    		</div>
    
    		<div id="form">
    <?php if ('open' == $post->comment_status) : ?>
    		<h5 id="respond">Leave a Reply</h5>
    <?php if ( get_option('comment_registration') && !$user_ID ) : ?>
    		<div class="comment">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.</div>
    <?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 <a href="<?php echo get_option('siteurl'); ?>/wp-admin/profile.php"><?php echo $user_identity; ?></a>. <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?action=logout" title="Log out of this account">Logout.</a></p>
    <?php else : ?>
    				<input type="text" name="author" id="author" size="30" value="<?php if($comment_author == "") echo 'Name'; else echo $comment_author; ?>" onblur="if (this.value == '') {this.value = 'Name';}"  onfocus="if (this.value == 'Name') {this.value = '';}" tabindex="1" />
    				<br /><input type="text" name="email" id="email" size="30" value="<?php if($comment_author_email == "") echo 'E-mail'; else echo $comment_author_email; ?>" onblur="if (this.value == '') {this.value = 'E-mail';}"  onfocus="if (this.value == 'E-mail') {this.value = '';}" tabindex="2" />
    				<br /><input type="text" name="url" id="url" size="30" value="<?php if($comment_author_url == "") echo 'Website'; else echo $comment_author_url; ?>" onblur="if (this.value == '') {this.value = 'Website';}"  onfocus="if (this.value == 'Website') {this.value = '';}" tabindex="3" />
    <?php endif; ?>
    				<br /><textarea name="comment" id="comment" cols="30" rows="3" tabindex="4"></textarea>
    				<br /><input name="submit" type="submit" id="submit" tabindex="5" value="Add Comment" />
    				<?php comment_id_fields(); ?>
    			<?php do_action('comment_form', $post->ID); ?></form>
    <?php endif; // If registration required and not logged in ?>
    <?php endif; // if you delete this the sky will fall on your head ?>
    		</div>

Viewing 4 replies - 1 through 4 (of 4 total)
  • No where in your code are you calling the comments template: <?php comments_template(); ?> – or <?php include('comments.php'); ?>

    If you don’t have a comments.php file, you will need to create one, if you do have one, you will need to bring it onto the page/post

    sorry – that is not your problem, you have the comments.php code above. I overlooked the file name. I will look at this a little closer then get back to you.

    Also, please check to be sure the comments are not held in moderation.

    Thread Starter straydog

    (@straydog)

    They are not, all comments have been approved.

    Thread Starter straydog

    (@straydog)

    *bump* Well, I’m not sure but if someone could, please check the single.php as well? The problem might be here although I highly doubt it… if anything, it’s probably in the comments.php above.

    <?php get_header(); ?>
    <?php if(have_posts()) : ?><?php while(have_posts()) : the_post(); ?>
    
    	<div class="post" id="post-<?php the_ID(); ?>">
    		<h1><?php the_title(); ?></h1>
    		<h3 class="postmetadata"><?php the_time('l, F jS Y') ?> <?php edit_post_link('Edit', ' | ', ''); ?> | <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">Permalink</a></h3>
    		<div class="entry">
    		<?php the_content(); ?> <?php link_pages('<strong>Pages:</strong> ', '
    ', 'number'); ?>
    		</div>
    		<?php comments_template(); ?>
    	</div>
    <?php endwhile; ?>
    
    	<div id="navigation"><?php previous_post_link('&laquo; %link') ?> <?php next_post_link(' %link &raquo;') ?></div>
    
    <?php else : ?>
    
    	<h2>Not Found</h2>
    	Sorry, but you are looking for something that isn't here.
    
    	<?php get_search_form(); ?>
    <?php endif; ?>
    <?php get_footer(); ?>

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Comments Not Showing Up’ is closed to new replies.