Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
96 lines (60 sloc) 5.45 KB
Please place the hybrid framework inside your theme and call it from functions.php file. Use require_once method. Example:
require_once( trailingslashit( TEMPLATEPATH ) . 'library/hybrid.php' );
The plugin called 'Sessions' and it includes custom post type 'sessions', custom taxonomy 'event' and 'venue'. It also includes a custom widget 'sessions-date'.
When this plugin will be activated, the sessions post-type, event and venue taxonomy and the widget will be also activated.
We need a separate table for venue taxonomy. We created a table using dbtable.php, table name 'wp_venuemeta'. The first time plugin is activated, then this table will be created automatically.
Post-type: Sessions
Located .../plugins/sessions-post-type/post-type/sessions/functions.php.
The post type uses Eventbrite API, so we included eventbrite.php class.
Located .../plugins/sessions-post-type/post-type/sessions/eventbrite.php.
To communicate with eventbrite we need application key and user key, for this we also created a central theme options page(admin-options.php) which is under Appearance->Stage Core Settings in dashboard where admin provides application and user key. Also we need an organisor key.
We also need a google map api key, to display google map in our venue taxonomy's edit page. Admin can provide their google map api key into our theme option page.
In sessions post-type we are doing couple of things, we are creating custom fields for our sessions, saving to database and also creating event into eventbrite website using our eventbrite API. We can make the event as 'draft' or 'publish' as we want, we can also 'edit' or/and 'delete' our event from our database as well from eventbrite website.
Title: Event name
Descriptions: Event descriptions
Price: Sessions price
Start Date: Start date of our sessions
End date: End date of our sessions
Timezone: Timezone of our sessions, most of the time it will be GMT+00 or GMT+01. (No need for input, it will be automatically selected based on current timezone in UK. If we find it is now summertime, then it will select GMT+00 otherwise GMT+01.
Event ID: No need for typing anything here, this textfield is disabled for input. The ID of the event will be returned from eventbrite after successful creation of event. We need this ID to update, delete of event/sessions.
We used DateTimePicker class for Start Date and End Date field. We used jQuery plugin DatePicker and also an addon TimePicker plugin.
Located into .../plugins/sessions-post-type/datepicker/datepicker.php. It also comes with separate css and javascript files.
Taxonomy: Event
'Event' taxonomy acts as category which will be used while we create a sessions.
Taxonomy: Venue
'Venue' taxonomy has several custom fields which we need to create a complete details of venue e.g. address, post code, country etc. We also displaying google map of the venue based on its address.
Located .../plugins/sessions-post-type/venue/venue-tax.php.
As it uses google map api, so we included GoogleMapAPI.class.php into same location.
Located .../plugins/sessions-post-type/venue/GoogleMapAPI.class.php.
It also uses Eventbrite API to create, update and delete operation on venue.
To create a venue using Eventbrite API, we also need an organisor key. Currently we created an organisor in eventbrite website and we using the ID. Currently it is constant. If you have new organisor key then copy and paste the key into our theme options page which is located into dashboard under Appearance->Stage Core Settings.
Widget: sessions-date
We created this widget to display sessions details based on the start dates.
How it works:
So if you attached this widget into any sidebar, it will find the start dates of all sessions and will display the dates. If you click any date, then it will display all sessions details on that particular date. and if you click 'Book Now' button then it will take you into eventbrite booking page.
If there is no tickets available then 'Book now' button won't be shown.
EventBrite API
We used following method of Eventbrite API
1. event_copy()
2. event_update()
3. venue_new()
4. venue_update()
5. event_get()
event_get() is used to find out the number of tickets left purposes.
event_update() is used to edit, delete operation on events.
event_copy() is used to copy the existing the event we created in our eventbrite account with additional details we want from attendees. We'll use event_copy when we create a new sessions and then update the existing event that event_copy created initially for us.
It seems we don't need event_new().
venue_new() is used to create a new venue.
venue_update() is used to edit the venue information. Delete operation can't be done with this method. Seems it doesn't exist!!!
Currently we can delete venue from database but it doesn't delete from our eventbrite site.
We need a separate table for venue taxonomy. We created a table using dbtable.php, table name 'wp_venuemeta'. The first time plugin is activated, then this table will be created automatically.