• I’m working on LA Snark and I’m trying to get the number of comments to appear within a single post. They show up next to the byline on the index, but disappear in the single post version.

    Also, I’d like each single post to end with a line that says how many comments there are. Something like “This post has 4 comments, join the conversation!” or “This post has no comments, be the first to post!”

    Your help is greatly appreciated.

    Here is my single post code:

    <?php get_header(); ?>

    <div id=”primary” class=”single”>

    <?php if(have_posts()) : ?>

    <?php while(have_posts()) : the_post(); ?>

    <div class=”entry hentry” id=”post-<?php the_ID(); ?>”>

    <h1 class=”entry-title”><?php the_title(); ?></h1>

    <div class=”entry-byline”>
    <span class=”entry-date”><abbr class=”updated” title=”<?php the_time(‘Y-m-d\TH:i:sO’); ?>”><?php the_time(‘M jS, Y’); ?></abbr></span>
    <address class=”author vcard”><?php _e(‘by ‘); ?>“><?php the_author(); ?>. </address>

    <?php edit_post_link(‘Edit’, ‘[‘, ‘]’); ?>
    </div>

    <div class=”entry-content”>
    <?php the_content(‘[Continue reading ⇒]’); ?>
    <?php wp_link_pages(‘before=<p>‘ . __(‘Pages:’) . ‘&after=</p>’); ?>

    </div>

    <p class=”entry-meta”><span class=”entry-categories”><?php _e(‘Posted in: ‘); ?><?php the_category(‘, ‘); ?>.</span>
    <?php if(function_exists(‘the_tags’)) { ?>
    <span class=”entry-tags”><?php the_tags(‘Tagged: ‘,’ · ‘,’
    ‘); ?></span>
    <?php } ?></p>

    </div><!–.entry–>

    <?php include (TEMPLATEPATH . ‘/navigation.php’); ?>

    <?php comments_template(); ?>

    <?php endwhile; ?>

    <?php else : ?>

    <div class=”entry”>
    <h2 class=”entry-title”><?php _e(‘Not Found’); ?></h2>
    <div class=”entry-content”>
    <p>Sorry, what you are looking for isn’t here.</p>
    <?php include (TEMPLATEPATH . “/searchform.php”); ?>
    </div>
    </div>

    <?php endif; ?>

    </div><!–#primary–>

    <?php get_sidebar(); ?>

    <?php get_footer(); ?>

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How do I add comment count in single post?’ is closed to new replies.