简体   繁体   English

WordPress-如何显示条目的评论总数?

[英]WordPress - How do I display the total number of comments from an entry?

I am displaying WordPress content on a static HTML page, which is outside of the WordPress content. 我在WordPress内容之外的静态HTML页面上显示WordPress内容。 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. 我对WordPress不太熟悉,因此我可以使用一些帮助来获取最后的代码。

Thanks! 谢谢!

You need something like this... 你需要这样的东西...

<a class="comments-ref" href="<?php comments_link(); ?>">
  <?php comments_number('0', '1', '%'); ?> Comments
</a>

Here is an article that may be of interest to you. 这是您可能感兴趣的文章 :) :)

e: Nice job, JAG2007. e:干得好,JAG2007。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM