Display a "View Calendar" Button if upcoming events active.

Support for the WordPress Calendar plugin
Frank3473
Posts: 2
Joined: Wed Dec 04, 2013 9:31 pm

Display a "View Calendar" Button if upcoming events active.

Unread post by Frank3473 » Wed Dec 04, 2013 9:38 pm

So we have a template with a sidebar button "View Calendar". The idea is that if no events are upcoming, hide the "View Calendar" button. Is there a conditional tag we can use (like if_page()) or something similar? we don't need to show the events, only to test if they exist.

This is going to be hard-coded in the theme, so we prefer not using shortcodes.

Thanks.

User avatar
Kieran
Posts: 2060
Joined: Sat May 26, 2007 1:55 pm
Location: London
Contact:

Re: Display a "View Calendar" Button if upcoming events acti

Unread post by Kieran » Thu Dec 05, 2013 10:13 am

If you retrieve the output from the function upcoming_events() function and it's empty, then that means no events are upcoming. If it's not empty then you can show your button. Hope that helps.

Frank3473
Posts: 2
Joined: Wed Dec 04, 2013 9:31 pm

Re: Display a "View Calendar" Button if upcoming events acti

Unread post by Frank3473 » Thu Dec 05, 2013 1:20 pm

Kieran,

Works perfectly. Thank you so much.

Post Reply