Count only published posts (in a tag)

I have a blog with a tag “Webinar”, and I wanted to create a feed (template partial) with a panel that shows only if there are some published posts tagged “Webinar.” I tried to do this, essentially:

{% set total_webinars = blog_total_post_count('XXXXXXXXXX', 'webinar') %}
{% if total_webinars > 0 %}

<div>
 <h4>Webinars</h4>
 {% set webinars = blog_recent_tag_posts('XXXXXXXXXX', 'webinar') %}

 <!-- for loop ... -->

</div>

{% endif %}

However, it’s counting drafts tagged “Webinar” too. How do I count only published posts tagged “Webinar”?

Hi, @SimonPadbury :waving_hand: Thanks for the great question. I think the main issue is HubL won’t differentiate between `draft` and published` the way you want it to for this project. Hey @alyssamwilie @miljkovicmisa @Kevin-C, do you have any workaround suggestions for @SimonPadbury?

Thanks! — Jaycee

Hey, I’ve figured it out myself.
First, in my original example code, `blog_total_post_count()` wasn’t accepting the parameter ‘webinar’ anyway -- and I should have expected that. `blog_total_post_count()` is simply returning a number, the number of posts (I am surprised that it’s counting drafts too).

Eventually I found `total_count` does what I want, and that leads to this simple solution:

{% set webinars = blog_recent_tag_posts('XXXXXXXXXX', 'webinar') %}
{% if webinars.total_count > 0 %}
<div>
 <h4>Webinars</h4>
 <!-- for loop ... -->
</div>
{% endif %}