customization - Show post count in custom taxonomy page

How can I show the post count in a taxonomy page. I tried some codes but I could not get success. I will locate this inf

How can I show the post count in a taxonomy page. I tried some codes but I could not get success. I will locate this information on the top of taxonomy page.

foreach ( get_the_terms( get_the_ID(), 'taxonomy' ) as $term )
{
  echo  $term->count ;
}

How can I show the post count in a taxonomy page. I tried some codes but I could not get success. I will locate this information on the top of taxonomy page.

foreach ( get_the_terms( get_the_ID(), 'taxonomy' ) as $term )
{
  echo  $term->count ;
}
Share Improve this question edited May 31, 2019 at 14:30 butlerblog 5,1313 gold badges28 silver badges44 bronze badges asked May 31, 2019 at 14:28 Ramin MahmudovRamin Mahmudov 511 silver badge12 bronze badges 1
  • I am using woody snippets plugin to insert php code to custom taxonomy page because i create custom taxonomies with post type builder plugin – Ramin Mahmudov Commented May 31, 2019 at 14:32
Add a comment  | 

1 Answer 1

Reset to default 0

İ found a solution:

$posts = get_queried_object();
echo $posts->count;

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745445705a4628036.html

相关推荐

  • customization - Show post count in custom taxonomy page

    How can I show the post count in a taxonomy page. I tried some codes but I could not get success. I will locate this inf

    11小时前
    10

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信