tags:

views:

28

answers:

2

I am displaying WordPress content on a static HTML page, which is outside of the WordPress content. It is working very nicely and I just need one more element to complete the set.

I am using this code:

<?php while (have_posts()): the_post(); ?>
  <h5><?php the_title(); ?></h5>
  <p class="blog-info"><?php the_time('m'); ?>.<?php the_time('j'); ?>.<?php the_time('y'); ?> | <a class="comment-ref">13 Comments</a></p>
<?php endwhile; ?>

The last part I need is the part where you can see a link with the total number of comments associated with the entry. Something like this:

<a class="comment-ref">13 Comments</a>

I am not very familiar with WordPress so I could use some help getting that last bit of code.

Thanks!

+4  A: 

You need something like this...

<a class="comments-ref" href="<?php comments_link(); ?>">
  <?php comments_number('0', '1', '%'); ?> Comments
</a>
JAG2007
Yup, comments_number is the way to go.http://codex.wordpress.org/Function_Reference/comments_number
Matt Gibson
Excellent. Worked perfectly! thanks.
fmz
+1  A: 

Here is an article that may be of interest to you. :)

e: Nice job, JAG2007.

Dan
Yes that is also a good thing to read through. What I posted was just one example of how to present the comments. There are actually several ways, including having it set to print "No Comments Yet" or "Be first to comment" if the value of comments is 0.
JAG2007