How to conditionally display widget? ie: no upcoming events = no widget

Home Forums Calendar Products Events Calendar PRO How to conditionally display widget? ie: no upcoming events = no widget

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #98556
    morktron
    Participant

    Hi, just a simple question – at the moment I’m using shortcode to display the pro events list widget directly from the template file (to avoid the client messing with it).

    I would like to only show the widget if there are some upcoming events. I know this is an option in the widget but I’m displaying the widget in the template file so the widget wrapper is still there.

    So what is the code to check if there are any upcoming events?

    #98921
    Barry
    Member

    Inspecting the result of tribe_get_events() (without providing any arguments) will probably give you the indication you need. If you need it to match specific criteria though, depending on what you are feeding through your shortcode logic, you might need to supply relevant arguments (to restrict it to upcoming events from a certain category, etc).

    Does that help?

    #98936
    morktron
    Participant

    Thanks barry for getting back to me, sorry I don’t know to do that. My only criteria would be ‘are there any events now or in the future’ I guess I’ll need to hire a developer unless you can help me further

    #99167
    Barry
    Member

    Well, I basically mean something like this – but yes if you need further assistance it might be best to consult a suitable designer/developer.

    I hope that helps!

    #99354
    morktron
    Participant

    Excellent thanks Barry, that is exactly what I was after, issue resolved! thanks so much, you are a legend 🙂

    #136003
    Barry
    Member

    (Closing this out!)

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘How to conditionally display widget? ie: no upcoming events = no widget’ is closed to new replies.