• Resolved mymommysplace

    (@mymommysplace)


    I’m beyond frustrated. I hope someone can help me.

    I have a new site: https://www.myohmomma.com/

    I have some comments on posts on my site. I see them in my dashboard, they are approved, in fact they were showing on my site this morning! I did some editing on single.php (to call different sidebars, depending on post category) and now they aren’t showing up on my single post pages.

    My single.php looks like this:

    <?php
    $post = $wp_query->post;
    if ( in_category('ohsays') ) {
    include(TEMPLATEPATH . '/single1.php');
    } else {
    include(TEMPLATEPATH . '/single2.php');
    }
    ?>
    
    ?>

    single1.php and single2.php each look like this, with the only difference being that I call a different sidebar:

    <?php get_header(); ?>
    
    <div id="container">
       <?php if(have_posts()) : ?><?php while(have_posts()) : the_post(); ?>
    
       <div class="post"> 
    
         <h2><a href="<?php the_permalink() ?>"  title="Permanent Link to <?php the_title(); ?>">
          <?php the_title(); ?></a></h2>
    
          <div class="entry">
              <?php the_content(); ?>
    
    <?php link_pages('<p><strong>Pages:</strong> ', '</p>', 'number'); ?>
    
    </div>
    
    <div class="comments-template">
    <?php
    $post = $wp_query->post;
    if (in_category( array( 3,9 ) ))  {
       include(TEMPLATEPATH . '/comments2.php');
    } else {
       include(TEMPLATEPATH . '/comments.php');
    }
    ?>
    
    </div>
    
    </div>
    <?php endwhile; ?>
    
    <?php else : ?>
    
    <div class="post">
    <h2><?php _e('Not Found'); ?></h2>
    </div>
    
    <?php endif; ?>
    </div>
    
    <?php get_sidebar(); ?>.
    
    <?php get_footer(); ?>. 
    
    </div>
    </body>
    </html>

    The relevant portions of my comments.php and comments2.php include this:

    <?php if ($comments) : ?>
    	<h3 id="comments"><?php comments_number('No Reviews', 'One Review', '% Reviews' );?> of “<?php the_title(); ?>”</h3>
    
    <ol class="commentlist">
    <?php wp_list_comments();?>
    <?php foreach ($comments as $comment) : ?>
    
    	<li class="<?php echo $oddcomment; ?>" id="comment-<?php comment_ID() ?>">
    
    <div class="commentmetadata">
    <?php if (defined("STARRATING_INSTALLED")) : ?>  
    
    <?php  wp_gdsr_comment_integrate_standard_result(get_comment_ID()); ?> 
    
    <?php _e('by'); ?> <strong><?php comment_author_link() ?></strong>, <?php _e('on'); ?> <a href="#comment-<?php comment_ID() ?>" title=""><?php comment_date('F jS, Y') ?> <?php _e('at');?> <?php comment_time() ?></a>  <?php edit_comment_link('Edit Comment','',''); ?>
     		<?php if ($comment->comment_approved == '0') : ?>
    		<em><?php _e('Your comment is awaiting moderation.'); ?></em>
     		<?php endif; ?> 
    
    </div>
    
    <?php endif; comment_text(); ?> 
    
    	</li>
    
    <?php /* Changes every other comment to a different class */
    	if ('alt' == $oddcomment) $oddcomment = '';
    	else $oddcomment = 'alt';
    ?>
    
    <?php endforeach; /* end for each comment */ ?>
    	</ol>

    I’m sorry to post so much code. I’m just lost. I can’t understand why comments were showing earlier but now they aren’t. I haven’t been able to figure it out. Chances are, it’s something obvious. Please, help!

Viewing 1 replies (of 1 total)
  • Thread Starter mymommysplace

    (@mymommysplace)

    I was able to resolve the problem myself. Instead of using this

    <div class="comments-template">
    <?php
    $post = $wp_query->post;
    if (in_category( array( 3,9 ) ))  {
       include(TEMPLATEPATH . '/comments2.php');
    } else {
       include(TEMPLATEPATH . '/comments.php');
    }
    ?>
    
    </div>

    to call different comment templates, I made different single.php files that called the appropriate comment.php.

    Perhaps I used too many conditional tags? I don’t know, but it’s doing what I want now.

Viewing 1 replies (of 1 total)
  • The topic ‘Comments not showing on single post page!’ is closed to new replies.