• straydog

    (@straydog)


    I recently installed WordPress 2.7 and converted from Cutenews. Everything seemed fine but the comments aren’t showing up on the entry pages (example here) but I see the comments in dashboard. I tried searching up a solution but was unsuccessful. I tried adding <?php comments_template(); ?> to page.php and <?php get_comments(); ?> as well; neither worked. It’s NOT a theme problem as I’m using the default presently.
    This is the code for page.php:

    <?php
    /**
     * @package WordPress
     * @subpackage Default_Theme
     */
    
    get_header(); ?>
    
    	<div id="content" class="narrowcolumn">
    
    		<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    		<div class="post" id="post-<?php the_ID(); ?>">
    		<h2><?php the_title(); ?></h2>
    			<div class="entry">
    				<?php the_content('<p class="serif">Read the rest of this page &raquo;
    '); ?>
    
    				<?php wp_link_pages(array('before' => '<strong>Pages:</strong> ', 'after' => '
    ', 'next_or_number' => 'number')); ?>
    
    			</div>
    		</div>
    		<?php endwhile; endif; ?>
    	<?php edit_post_link('Edit this entry.', '', '
    '); ?>
    	</div>
    
    <?php get_sidebar(); ?>
    
    <?php get_footer(); ?>

    This is comments.php (if it helps…):

    <?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;
    	}
    ?>
    
    <!-- You can start editing here. -->
    
    <?php if ( have_comments() ) : ?>
    	<h3 id="comments"><?php comments_number('No Responses', 'One Response', '% Responses' );?> to “<?php the_title(); ?>”</h3>
    
    	<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(); ?>
    	</ol>
    
    	<div class="navigation">
    		<div class="alignleft"><?php previous_comments_link() ?></div>
    		<div class="alignright"><?php next_comments_link() ?></div>
    	</div>
     <?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">
    
    <h3><?php comment_form_title( 'Leave a Reply', 'Leave a Reply to %s' ); ?></h3>
    
    <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 <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?redirect_to=<?php echo urlencode(get_permalink()); ?>">logged in</a> 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 <a href="<?php echo get_option('siteurl'); ?>/wp-admin/profile.php"><?php echo $user_identity; ?></a>. <a href="<?php echo wp_logout_url(get_permalink()); ?>" title="Log out of this account">Log out &raquo;</a></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>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><strong>XHTML:</strong> You can use these tags: <code><?php echo allowed_tags(); ?></code></small></p>-->
    
    <p><textarea name="comment" id="comment" cols="100%" rows="10" tabindex="4"></textarea></p>
    
    <p><input name="submit" type="submit" id="submit" tabindex="5" value="Submit Comment" />
    <?php comment_id_fields(); ?>
    </p>
    <?php do_action('comment_form', $post->ID); ?>
    
    </form>
    
    <?php endif; // If registration required and not logged in ?>
    </div>
    
    <?php endif; // if you delete this the sky will fall on your head ?>

    Thanks in advance.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Samuel B

    (@samboll)

    in page.php
    adding
    <?php comments_template(); ?>
    right after

    <?php the_content('<p class="serif">Read the rest of this page &raquo;
    '); ?>

    should work

    Thread Starter straydog

    (@straydog)

    Nevermind, it seems that I’ve got the wrong file to edit. It’s not page.php, but single.php because it’s the single page for one post entry. I’ve checked the single.php after reuploading a new one just in case and it has <?php comments_template(); ?> but comments still aren’t showing up.
    The file:

    <?php
    /**
     * @package WordPress
     * @subpackage Default_Theme
     */
    
    get_header();
    ?>
    
    	<div id="content" class="widecolumn">
    
    	<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    
    		<div class="navigation">
    			<div class="alignleft"><?php previous_post_link('&laquo; %link') ?></div>
    			<div class="alignright"><?php next_post_link('%link &raquo;') ?></div>
    		</div>
    
    		<div <?php post_class() ?> id="post-<?php the_ID(); ?>">
    			<h2><?php the_title(); ?></h2>
    
    			<div class="entry">
    				<?php the_content('<p class="serif">Read the rest of this entry &raquo;</p>'); ?>
    
    				<?php wp_link_pages(array('before' => '<p><strong>Pages:</strong> ', 'after' => '</p>', 'next_or_number' => 'number')); ?>
    				<?php the_tags( '<p>Tags: ', ', ', '</p>'); ?>
    
    				<p class="postmetadata alt">
    					<small>
    						This entry was posted
    						<?php /* This is commented, because it requires a little adjusting sometimes.
    							You'll need to download this plugin, and follow the instructions:
    							http://binarybonsai.com/archives/2004/08/17/time-since-plugin/ */
    							/* $entry_datetime = abs(strtotime($post->post_date) - (60*120)); echo time_since($entry_datetime); echo ' ago'; */ ?>
    						on <?php the_time('l, F jS, Y') ?> at <?php the_time() ?>
    						and is filed under <?php the_category(', ') ?>.
    						You can follow any responses to this entry through the <?php post_comments_feed_link('RSS 2.0'); ?> feed.
    
    						<?php if (('open' == $post-> comment_status) && ('open' == $post->ping_status)) {
    							// Both Comments and Pings are open ?>
    							You can <a href="#respond">leave a response</a>, or <a href="<?php trackback_url(); ?>" rel="trackback">trackback</a> from your own site.
    
    						<?php } elseif (!('open' == $post-> comment_status) && ('open' == $post->ping_status)) {
    							// Only Pings are Open ?>
    							Responses are currently closed, but you can <a href="<?php trackback_url(); ?> " rel="trackback">trackback</a> from your own site.
    
    						<?php } elseif (('open' == $post-> comment_status) && !('open' == $post->ping_status)) {
    							// Comments are open, Pings are not ?>
    							You can skip to the end and leave a response. Pinging is currently not allowed.
    
    						<?php } elseif (!('open' == $post-> comment_status) && !('open' == $post->ping_status)) {
    							// Neither Comments, nor Pings are open ?>
    							Both comments and pings are currently closed.
    
    						<?php } edit_post_link('Edit this entry','','.'); ?>
    
    					</small>
    				</p>
    
    			</div>
    		</div>
    
    	<?php comments_template(); ?>
    
    	<?php endwhile; else: ?>
    
    		<p>Sorry, no posts matched your criteria.</p>
    
    <?php endif; ?>
    
    	</div>
    
    <?php get_footer(); ?>

    Thread Starter straydog

    (@straydog)

    I reinstalled wordpress and found that the comments were working. I later discovered that they were not showing up because of the permalinks. I’d chose to use /%year%/%monthnum%/%day%/ and that does not work so I just switched over to /%year%/%monthnum%/%day%/%post_id%/. Hope the hint helps people with similar problems.

    sherrigd45

    (@sherrigd45)

    I am also having problems with the comments not showing. I changed the permalinks to be the “Custom Structure” and put in: /%postname%/

    I don’t know anything about the code here. But it creates the desired permalink address (displayed at the top in the edit section) and when I hover over the title in the displayed page.

    Any ideas?

    had a similar problem & this fixed it.

    http://wordpress.org/support/topic/274144?replies=2

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Comment section is not showing up on pages’ is closed to new replies.