Simple Calendar and Custom Theme
-
Good afternoon!
We have a site which uses Simple Calendar.
We are about to switch to a new custom theme. In an attempt to make things as easy as possible for the people using the website, they have placed a “settings” page where the various people paste in a url to their Google Calendar (i.e. bmchs.org_2i1q9e2a5o3ud6d9qji33a2reg%40group.calendar.google.com).
I would like to keep using Simple Calendar and am trying to figure out a way to implement it using the setup given. Right now, it is used for all the sports at the school. Some sports have 6 calendars. They have made it work with Google calendar using it’s default embed code, as you can see here: https://www.bmchs.org/athletics/sports/basketball/basketball-calendar/
The code that is creating this:
<?php if ( is_page('Basketball Calendar') ) { $current_sport = 'Basketball'; $athletic_calendar = get_field('calendar_basketball', 'option'); $athletic_calendar_boys_varsity = get_field('boys_varsity_calendar_basketball', 'option'); $athletic_calendar_girls_varsity = get_field('girls_varsity_calendar_basketball', 'option'); $athletic_calendar_boys_jv = get_field('boys_jv_calendar_basketball', 'option'); $athletic_calendar_girls_jv = get_field('girls_jv_calendar_basketball', 'option'); $athletic_calendar_boys_freshmen = get_field('boys_freshmen_calendar_basketball', 'option'); $athletic_calendar_girls_freshmen = get_field('girls_freshmen_calendar_basketball', 'option'); } ?> <?php $calendar_string = 'src=' . $athletic_calendar . '&'; if ( $athletic_calendar_boys_varsity ) : $calendar_string .= 'src=' . $athletic_calendar_boys_varsity . '&'; endif; if ( $athletic_calendar_girls_varsity ) : $calendar_string .= 'src=' . $athletic_calendar_girls_varsity . '&'; endif; if ( $athletic_calendar_boys_jv ) : $calendar_string .= 'src=' . $athletic_calendar_boys_jv . '&'; endif; if ( $athletic_calendar_girls_jv ) : $calendar_string .= 'src=' . $athletic_calendar_girls_jv . '&'; endif; if ( $athletic_calendar_boys_freshmen ) : $calendar_string .= 'src=' . $athletic_calendar_boys_freshmen . '&'; endif; if ( $athletic_calendar_girls_freshmen ) : $calendar_string .= 'src=' . $athletic_calendar_girls_freshmen . '&'; endif; ?> <?php echo '<iframe src="https://calendar.google.com/calendar/embed?showTitle=0&showTz=0&height=685&wkst=1&bgcolor=%23ffffff&' . $calendar_string . 'color=%230D7813&ctz=America%2FChicago" style="border-width:0" width="100%" height="685" frameborder="0" scrolling="no"></iframe>' ;?>I know that in the past, you could use the Simple Calendar shortcode and then add some variable in the shortcode, but I’m not sure that is possible anymore.
So I guess the question I have is how to best implement Simple Calendar within the PHP of the theme? What I would like to be able to do is something like:
[calendar src=$calendar_string]Because the pages will be set in stone, only one person will have access to the WP backend, and the people maintaining the content won’t actually be in the wp admin, they are in a custom interface where they only have access to update certain custom fields. Does this make any sense?
The topic ‘Simple Calendar and Custom Theme’ is closed to new replies.