Created
October 15, 2011 14:16
-
-
Save billerickson/1289628 to your computer and use it in GitHub Desktop.
Interstrategy Events Manager - Custom Event Information
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Custom Event Information | |
* If you want to collect different information on the events, you'll need | |
* to define your own metabox with its fields, and then disable the default metabox. | |
* More documentation on making metaboxes at the link below. | |
* @author Bill Erickson | |
* @link https://github.com/jaredatch/Custom-Metaboxes-and-Fields-for-WordPress | |
* @link http://wordpress.org/support/topic/plugin-interstrategy-events-manager-documentation | |
* | |
* @param array, current metaboxes | |
* @return array, current and new metaboxes | |
*/ | |
function be_create_events_metaboxes( $meta_boxes ) { | |
// You'll want to use the same prefix and field names for fields like start and end date, | |
// or you'll have to rebuild the query sorting as well. | |
$prefix = 'be_events_manager_'; | |
$meta_boxes[] = array( | |
'id' => 'event-details', | |
'title' => 'Event Details', | |
'pages' => array('event'), | |
'context' => 'normal', | |
'priority' => 'high', | |
'show_names' => true, | |
'fields' => array( | |
array( | |
'name' => 'Location', | |
'id' => $prefix . 'location', | |
'desc' => '', | |
'type' => 'text' | |
), | |
array( | |
'name' => 'Start Date', | |
'id' => $prefix . 'start_date', | |
'desc' => '', | |
'type' => 'text_date_timestamp', | |
), | |
array( | |
'name' => 'End Date', | |
'id' => $prefix . 'end_date', | |
'desc' => '', | |
'type' => 'text_date_timestamp', | |
), | |
array( | |
'name' => 'Cost', | |
'id' => $prefix . 'cost', | |
'desc' => '', | |
'type' => 'text_money', | |
), | |
array( | |
'name' => 'Telephone', | |
'id' => $prefix . 'telephone', | |
'desc' => '', | |
'type' => 'text_medium' | |
) | |
) | |
); | |
// When you're done making metaboxes, don't forget to return them. | |
return $meta_boxes; | |
} | |
add_filter( 'cmb_meta_boxes', 'be_create_events_metaboxes' ); | |
// Now let's disable the default event metabox | |
add_filter( 'be_events_manager_metabox_override', '__return_true' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment