Wp Calendar Plugin is not perfect but was the best 1 from all the calendars I tried. It is the easiest to understand and adaptable to the way I wanted it also uses the built in Categories, unlike some others which use separate categories
Installation is easy though the add plugin, once installed you have a new admin menu item and a configuration tab under settings ,
There is only 2 main thing you need that is a page for the calendar and a page for the events to show the calendar you use
{calendar}
or
{events_calendar; categories="3,5"; height=600; header->left="prev"; header->center="today, title"; header->right="next"; weekends=false}
both show the calendar the code I use is
{events_calendar; categories="5,6,7,8"; height=600; header->left="title"; header->center="today"; header->right="prev, next"; weekends=false}
notice the categories this will show the calendar with only the categories selected this way you can create multiple calendars showing only the category you want on each
the configuration has 7 tabs :-
- Global
- pagination (exactly what it says)
- Events page
- Graphical Calendar (calendar date/time & format)
- Admin Settings
- Documentation
- About
Global is where you set the number of events, the date & time format event settings and templates
Events page is where you set the page to display the events (when clicked in the calendar)
to show these events you need to place short codes in the page aq list of which can ve found in the documentation tab of the settings
Admin settings where you select the type of calendar to display and some default settings start / end time
Documentation Gives all the accepted tags (some say there is not enough information here ) I find it acceptable for simple use
now for categories I use
Royal Arch(iCal) |
Lodge & Council(iCal) |
Cryptic Council(iCal) |
Provincial Visitation (iCal) |
full calendar (iCal) |
This is how to use the ical with wp-calendar
a href=”http://www.pgracglasgow.co.uk/?wp-calendar-ical&category=5″ <> removed (iCal)
Each of these have there own code in the styles.css
.fc-grid .fc-event-time { // hides the time on the calendar display: none; } .fc-event.category-5, //Royal Arch .fc-event.category-5 div { background-color: white; border-width: 2px; border-color: red; color: red; } .fc-event.category-6, //Cryptic Council .fc-event.category-6 div { background-color: white; border-width: 2px; border-color: purple; color: purple; } .fc-event.category-7, // Lodge & Council .fc-event.category-7 div { background-color: white; border-width: 2px; border-color: green; color: green; } .fc-event.category-8, // Provincial .fc-event.category-8 div { background-color: white !important; border-width: 2px !important; border-color: blue !important; color: black ; }
If you noticed the use of !important in category-8 this will take precedence when events fall into 2 categories I will explain how this is used later on
Entering events in the calendar is as simple as creating a post it is quite similar with the addition of Date ,time ,Location and category
on the provincial site I have a custom page that makes use of the categories and displays all events in the provincial category but then sorts them by the other categories in date order This page is active twice a year for the installations and provincial visitations the events no longer show when the date has passed eventually the page shows no events
the code for this page uses short codes to product the page
[mm-event catid=5] [mm-event catid=6] [mm-event catid=7]
this page uses 2 things a function code and css
the CSS code in styles.css
/* ===== Styles for shortcode mm-event ==== */ .ae-events { width: 60%; margin: auto; } .ae-catname { background-image: url("images/blockheader.png"); text-align: center; background: #e5c348; font-size: 1.5em; color: #000000; margin: 20px auto; padding-top: 10px; padding-bottom: 10px; } .ae-event { border-bottom: 1px solid black; padding-bottom: 5px; margin-bottom: 10px; } .ae-subject { /* Similar to h2 */ color: #000000; font-size: 22px; margin: 0.2em 0; } /* ==== End Styles for mm-event ==== */
and the function code in functions.php
// Shortcode for WP Support scribe257 // [mm-event catid=7] // catid is 5, 6, or 7 function mm_event_function ($atts) { global $wpdb,$mm_events; extract(shortcode_atts(array( 'catid' => 0, ), $atts)); $op = ''; if (!$mm_events) { $sql = " SELECT DISTINCT events.*,cats2.catid FROM wp_fsevents events JOIN wp_fsevents_cats cats1 ON (events.eventid = cats1.eventid) JOIN wp_fsevents_cats cats2 ON (events.eventid = cats2.eventid) WHERE cats1.catid = 8 AND cats2.catid IN (5,6,7) AND events.datefrom > NOW() ORDER BY events.datefrom, events.dateto"; $annual_events = $wpdb->get_results($sql); // Get events into arrays keyed on [catid] foreach ($annual_events as $event) { $mm_events["$event->catid"][] = $event; } } if ($events_in_cat = $mm_events[$catid]) { $catname = get_cat_name($catid); $pg = get_option('fse_page'); // Get the single event display page $url = ''; if ($pg) $url = add_query_arg('page_id',$pg,home_url()); $op .= "\n"; $op .= "\n"; } return $op; } add_shortcode('mm-event','mm_event_function');Meetings for $catname\n"; foreach ($events_in_cat as $annual_event) { $op .= "\n"; $op .= "\n"; } $op .= ""; if ($url) $op .= "eventid,$url) . "' >"; $op .= $annual_event->subject; if ($url) $op .= ''; $op .= "\n"; $op .= "" . date('F jS, Y', strtotime($annual_event->datefrom)) . "\n"; $op .= "$annual_event->description\n"; $op .= "\n"; $op .= "
As you can see this uses a lot of MySQL query and it is beyond my skills and I got help from Mac who wrote the code although I cannot write code like this I can understand it and know what does what. My knowledge and understanding of php , MySQL is getting better all the time.
Finally with everything working i cannot relax as update are constant and always have a chance of breaking the plug-in in some way as i have found out with the php5.4 update at first it did not show any calendar then when it did thier was no events in it
the solution GO SLOW and check everything on all pages that use any related settings one of the things i found was it started puttin the shortcodes in Coded brackets which did not help then i found out that the calendar paramiters no longer worked only the Event_calendar worked the categories needed a blank cat first as 1st category did not show on calendar