How to check if a shortcode is blank?

A demo of what the website would automatically look like

I have a website for my robotics team, and I need help with it.

We are displaying our sponsors through the https://wordpress.org/plugins/wp-sponsors/ plugin. In order to let us show the sponsors sorted by category, we use an HTML widget with the shortcode[sponsors category=______].

We have 3 different categories for our sponsors: Bronze, Silver, and Gold. I want to make it so that it will only show the label for the sponsors if there is at least one sponsor of that kind. How do I make it do this automatically show/hide this title only if there are sponsors? Right now, we have to go into the code and manually comment out our titles like so:

<strong>
<!--Gold Sponsors-->
</strong><br>
[sponsors category=gold]
<br>

<strong>
<!––Silver Sponsors-->
</strong><br>
[sponsors category=silver]
<br>

<strong>
<!--Bronze Sponsors-->
</strong><br> 
[sponsors category=bronze]

This is what I would want the website to look like with only one gold and one bronze sponsor:

Is there an easier way so that, if the future webmaster does not know HTML, he will not have to code anything?

Read more here:: How to check if a shortcode is blank?

Leave a Reply

Your email address will not be published. Required fields are marked *