-
-
Save GaryJones/1547753 to your computer and use it in GitHub Desktop.
Create session metaboxes
This file contains hidden or 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 | |
add_action( 'init', 'be_initialize_meta_boxes' ); | |
/** | |
* Initialize the metabox code library. | |
* | |
* Since this code might be in the theme and multiple plugins, | |
* see if it exists already before initializing it. | |
* | |
*/ | |
function initialize_meta_boxes() { | |
if ( ! class_exists( 'cmb_Meta_Box' ) ) | |
require_once( 'lib/metabox/init.php' ); | |
} | |
add_filter( 'cmb_meta_boxes', 'be_session_metabox' ); | |
/** | |
* Define metabox configuration. | |
*/ | |
function be_session_metabox() { | |
return array( | |
'id' => 'session-details', | |
'title' => 'Session Details', | |
'pages' => array( 'sessions', ), | |
'context' => 'normal', | |
'priority' => 'high', | |
'show_names' => true, | |
'fields' => array( | |
array( | |
'name' => 'Date', | |
'id' => 'be_session_date', | |
'desc' => '', | |
'type' => 'text_date_timestamp', | |
), | |
array( | |
'name' => 'Time', | |
'id' => 'be_session_time', | |
'desc' => '', | |
'type' => 'text_time', | |
), | |
array( | |
'name' => 'Location', | |
'id' => 'be_session_location', | |
'desc' => '', | |
'type' => 'wysiwyg', | |
'options' => array( | |
'textarea_rows' => 5, | |
'media_buttons' => false, | |
), | |
), | |
), | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment