Auto publish post based on a condition?

I have an events setup with four categories of events (posts). I have a php code that will auto un-publish an event the day after the event date (date is created with ACF). I’m using Elementor with a loop grid and taxonomy filter to sort by category. This all works great.

Now, in a couple categories there may be periods of time when there are no events in that category, so I’d like to create a post saying “currently no events scheduled, check back, follow on social, blah, blah” that auto publishes when the last event auto un-publlishes.

Anyone have an idea of how to accomplish this?

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer